2 Week 2

This week we will consider the equations of tangents and normals and then complete our rules for differentiation by looking at

  1. Chain rule
  2. Product rule
  3. Quotient rule.

2.1 Tangents and Normals

Two lines are parallel if their gradients are identical. For example \(y=2x\), \(y=2x-2\) and \(y=2x+3\) all have gradient of \(2\) and hence are all parallel (Figure 2.1).

parallel lines

Figure 2.1: parallel lines

If two lines are perpendicular, there is also a certain relationship between their gradients. Consider Figure 2.2.

perpendicular lines

Figure 2.2: perpendicular lines

The gradient of the line \(l_1\) is given by the ratio \[ \frac{m}{1}, \] while the gradient of the line \(l_2\) is given by the ratio \[ \frac{1}{-m}. \] So if a line has gradient \(m\) then the gradient of the line perpendicular to it has gradient \(-1/m\), and so \[ \text{gradient of }(l_1) \times \text{ gradient of }(l_2) = -1. \] Now consider Figure 2.3.

tangent and normal

Figure 2.3: tangent and normal

The normal is the line at \(90^\circ\) to the tangent, passing through the point where the tangent touches the curve. Thus in the figure, the tangent is the line \(PT\) and the normal is the line \(PN\). We already know that the gradient of the tangent is given by \[ m = \frac{\mathrm{d} y}{\mathrm{d} x}\text{ at the point }P, \] and so from the argument above, the gradient of the normal to the tangent is given by \[ \frac{-1}{m} = \frac{-1}{{\mathrm{d} y/\mathrm{d} x}}. \] Now, the equation of the line with gradient \(m\), passing through the point \(P=(x_1,y_1)\) is given by \[ y-y_1 = m(x-x_1). \] So the equation of the tangent is \[ y - y_1 = \frac{\mathrm{d} y}{\mathrm{d} x}(x-x_1), \] while the equation of the normal to the curve is \[ y - y_1 = \frac{-1}{{\mathrm{d} y/\mathrm{d} x}}(x-x_1). \]

Example 2.1 Find the equation of the tangent and the normal to the curve \(y = x^2+5x\) at the point \(x=2\).

Solution. If \(y=x^2+5\) then \({\mathrm{d} y/\mathrm{d} x} = 2x+5\).

At \(x_1=2\), \(y_1 = 2^2 + 5\times2 = 14\) and \({\mathrm{d} y/\mathrm{d} x} = 2\times2+5=9\). The equation of the tangent is therefore \[ y-14=9(x-2) = 9x - 18\text{ and so }y = 9x-4. \] The equation of the normal is \[ y-14=\frac{-1}{9}(x-2) = \frac{-1}{9}x - \frac{2}{9}\text{ and so }y = -\frac{x}{9}+\frac{128}{4}. \]

2.2 The Chain Rule

A function may be considered as an operation that has to be done to \(x\) to get \(y\). For example if \(y = f(x) = x^2\) then the function (called \(f\) in this case) is: square the value of \(x\).

For \(y = g(\theta) = \sin(\theta)\) the function (called \(g\) in this case) is: evaluate the sine of \(\theta\).

If we now look at \((x^2 + 4)^3\) then we can consider this as one function described be performing these steps:

  1. take \(x\),
  2. square it,
  3. add \(4\) to the previous result, and then
  4. cube the preceding result.

So we can write \[ y = f(x) = (x^2+ 4)^3, \] or we can think of \(f\) as (a composition of) two functions: \[\begin{align*} u &= g(x) = x^2 + 4\\ y &= h(u) = u^3, \end{align*}\] or we can even consider it as (a composition of) 3 functions: \[\begin{align*} u &= k(x) = x^2\\ v &= m(u) = u + 4\\ y &= n(v) = v^3. \end{align*}\] In the first case, the value of \(y\) is calculated all in one attempt. In the second case, \(u\) is calculated from \(x\) according to the rule of the function \(g\), then \(y\) is calculated using \(u\) and the rule of the function \(h\). In the third case \(u\) is calculated from \(x\) according to the rule \(k\), then \(v\) is calculated from \(u\) according to the rule \(m\), and finally \(y\) is calculated from the value of \(v\) according to the rule \(n\).

We shall consider the second case. Recall: \[\begin{align*} u &= g(x) = x^2+ 4\\ y &= h(u) = u^3. \end{align*}\] By substituting for \(u\) we can write \(y = h(g(x))\) which means: to get \(y\) from \(x\), first apply the rule \(g\) (get \(x\), square it and add \(4\)) and then apply the rule \(h\) (cube the answer to operation \(g\)). When \(y\) is written in this form it is called a function of a function or a composite functon.

2.2.1 The Chain Rule: Differentiating composite functions

Let consider the function \(y = (x^2+ 4)^3\). Up to now, if we wanted to differentiate \(y = (x^2 + 4)^3\), we had to multiply out the brackets to get a string of things added together, since so far the only things we can differentiate are sums of terms of standard functions (e.g. \(\sin(x), \cos(x), \ln(x)\), etc).

The chain rule allows us to differentiate functions of functions without having to multiply out all the brackets.

Recall that we “decompose” \(y=(x^2+4)^3\) as \(u = g(x) = x^2+4\), \(y = h(u) = u^3\). Thus \[ \frac{\mathrm{d} y}{\mathrm{d} u} = 3u^2 \quad\text{ and }\quad \frac{\mathrm{d} u}{\mathrm{d} x} = 2x \] (using ordinary differentiation by rule).

However, we want to find \[ \frac{\mathrm{d} y}{\mathrm{d} x}. \] The chain rule says that \[ \frac{\mathrm{d} y}{\mathrm{d} x} = \frac{\mathrm{d} y}{\mathrm{d} u}\times \frac{\mathrm{d} u}{\mathrm{d} x}. \] (This can be proved from first principles, but we won’t.) So \[ \frac{\mathrm{d} y}{\mathrm{d} x} = \frac{\mathrm{d} y}{\mathrm{d} u}\times \frac{\mathrm{d} u}{\mathrm{d} x} = 3u^2\times 2x = 6xu^2. \] But since \(u = x^2+4\), we have \[ \frac{\mathrm{d} y}{\mathrm{d} x} = 6x(x^2 +4)^2. \]

Remark. The chain rule can be extended for any number of functions, for example \[ \frac{\mathrm{d} y}{\mathrm{d} x} = \frac{\mathrm{d} y}{\mathrm{d} a}\times \frac{\mathrm{d} a}{\mathrm{d} b}\times \frac{\mathrm{d} b}{\mathrm{d} c}\times \frac{\mathrm{d} c}{\mathrm{d} e}\times\frac{\mathrm{d} e}{\mathrm{d} f}\times\frac{\mathrm{d} f}{\mathrm{d} x}. \]

Example 2.2 Differentiate \(s = (2t^2- 4t)^5\) with respect to \(t\).

Solution. Let \(u = 2t^2-4t\) and \(s = u^5\). Then \[ \frac{\mathrm{d} u}{\mathrm{d} t} = 4t-4\text{ and }\frac{\mathrm{d} s}{\mathrm{d} u} = 5u^4 \] So \[ \frac{\mathrm{d} s}{\mathrm{d} t} = \frac{\mathrm{d} s}{\mathrm{d} u}\times\frac{\mathrm{d} u}{\mathrm{d} t} = 5u^4(4t-4). \] But since \(u = 2t^2-4t\) then \[ \frac{\mathrm{d} s}{\mathrm{d} t} = 5(2t^2-4t)^4(4t-4). \]

Example 2.3 Differentiate \(y=5\cos(5\theta)\) with respect to \(\theta\).

Solution. Let \(u = 5\theta\) and \(y = 5\cos(u)\). Then \[ \frac{\mathrm{d} u}{{\mathrm{d} \theta}} = 5\text{ and }\frac{\mathrm{d} y}{\mathrm{d} u} = -5\sin(u) \] So \[ \frac{\mathrm{d} y}{{\mathrm{d} \theta}} = \frac{\mathrm{d} y}{\mathrm{d} u}\times\frac{\mathrm{d} u}{{\mathrm{d} \theta}} = -5\sin(u)\times5. \] But since \(u = 5\theta\) then \[ \frac{\mathrm{d} y}{{\mathrm{d} \theta}} = -25\sin(5\theta). \]

Example 2.4 Differentiate \(y=e^{2x+3}\) with respect to \(x\).

Solution. Let \(u = 2x+3\) and \(y = e^u\). Then \[ \frac{\mathrm{d} u}{\mathrm{d} x} = 2\text{ and }\frac{\mathrm{d} y}{\mathrm{d} u} = e^u \] So \[ \frac{\mathrm{d} y}{\mathrm{d} x} = \frac{\mathrm{d} y}{\mathrm{d} u}\times\frac{\mathrm{d} u}{\mathrm{d} x} = e^u\times2. \] But since \(u = e^u\) then \[ \frac{\mathrm{d} y}{\mathrm{d} x} = 2e^{2x+3}. \]

2.3 The Product and Quotient Rules

2.3.1 Differentiation of a product

So far, if we want to differentiate a function which is a product of two functions of \(x\), like \(y = 4x^2(3x^3 - 6x)\), we need to multiply out the brackets and differentiate term by term as follows; \[\begin{gather*} y = 4x^2(3x^3 - 6x) = 12x^5 - 24x^3\\ \frac{\mathrm{d} y}{\mathrm{d} x} = 60x^4 - 72x^2 = 12x^2(5x^2 - 6) \end{gather*}\] For some products, multiplying terms out still doesn’t help to differentiate them e.g. \[ y = \sqrt{x^2 - 2x} \sin(x). \] (We could use binomial expansion for the first factor, but we still don’t have tools to turn \(\sin(x)\) into a power series.)

We’d like a general rule for differentiating a product.

From the first example above, we see that the derivative of a product is not just the derivative of each factor, as that would give \(8x(9x^2 - 6) = 72x^3 - 48x\).

Let \(u = u(x)\) and \(v = v(x)\) be functions of \(x\).

If \(y = u(x)v(x)\), then \(y(x+h) = u(x+h)v(x+h)\), so \[y(x+h)-y(x) = u(x+h)v(x+h) - u(x)v(x).\] Now we do a trick: add and subtract \(u(x+h)v(x)\): \[\begin{align*} y(x+h)-y(x) &= u(x+h)v(x+h) - u(x+h)v(x)\\ &\phantom{=} + u(x+h)v(x) - u(x)v(x). \end{align*}\] Further, dividing both sides of equation by \(h\) gives \[\begin{align*} \frac{y(x+h)-y(x)}{h} &= u(x+h)\frac{v(x+h) - v(x)}{h} \\ &\phantom{=} + v(x)\frac{u(x+h ) - u(x)}{h}. \end{align*}\] In the limit as \(h\) tends to \(0\), we have \(u(x+h)\to u(x)\), and so \[ \frac{\mathrm{d} y}{\mathrm{d} x} = u\frac{\mathrm{d} v}{\mathrm{d} x} + v\frac{\mathrm{d} u}{\mathrm{d} x}. \] Equivalently, \[ \frac{\mathrm{d}(uv)}{\mathrm{d} x} = u\frac{\mathrm{d} v}{\mathrm{d} x} + v\frac{\mathrm{d} u}{\mathrm{d} x}. \] This is called the product rule.

Example 2.5 Differentiate \(y=4x^2(3x^3-6x)\) with respect to \(x\).

Solution. Let \(u = 4x^2\) and \(v = 3x^3-6x\). Then \[ \frac{\mathrm{d} u}{\mathrm{d} x} = 8x\text{ and }\frac{\mathrm{d} v}{\mathrm{d} x} = 9x^2-6. \] Hence the product rule gives \[\begin{gather*} \frac{\mathrm{d} y}{\mathrm{d} x} = u\frac{\mathrm{d} v}{\mathrm{d} x} + v\frac{\mathrm{d} u}{\mathrm{d} x} = (3x^3-6x)\times 8x + 4x^2\times(9x^2-6)\\ 24x^4 - 48x^2 + 36x^4-24x^2 = 60x^4-72x^2 = 12x^2(5x^2-6). \end{gather*}\]

Example 2.6 Differentiate \(y=\sqrt{x^2-2x}\sin(x)\) with respect to \(x\).

Solution. Let \(u = \sqrt{x^2-2x} = (x^2-2x)^{1/2}\) and \(v = \sin(x)\). Then \[ \frac{\mathrm{d} u}{\mathrm{d} x} = \frac12(x^2-2x)^{-1/2}(2x-2)=(x^2-2x)^{-1/2}(x-1)\text{ and }\frac{\mathrm{d} v}{\mathrm{d} x} = \cos(x). \] Hence the product rule gives \[\begin{gather*} \frac{\mathrm{d} y}{\mathrm{d} x} = u\frac{\mathrm{d} v}{\mathrm{d} x} + v\frac{\mathrm{d} u}{\mathrm{d} x} = (x^2-2x)^{1/2}\cos(x) + \sin(x)(x^2-2x)^{-1/2}(x-1)\\ \frac{(x-1)\sin(x)}{(x^2-2x)^{1/2}} + (x^2-2x)^{1/2}\cos(x). \end{gather*}\]

2.3.2 Differentiation of a quotient

Suppose that \[ y = \frac{u(x)}{v(x)} = \frac{u}{v}. \] Considering a small \(h\), we have \(y(x+h) = \dfrac{u(x+h)}{v(x+h)}\). Hence \[\begin{align*} y(x+h)-y(x) &= \frac{u(x+h)}{v(x+h)} - \frac{u(x)}{v(x)}\\ &=\frac{v(x)u(x+h)-u(x)v(x+h)}{v(x+h)v(x)}\\ &=\tfrac{v(x)u(x+h)-v(x)u(x)+v(x)u(x)-u(x)v(x+h)}{v(x+h)v(x)}. \end{align*}\] Dividing by \(h\) and rearranging, we get \[ \frac{y(x+h)-y(x)}{h} = \frac{v(x)\frac{u(x+h)-u(x)}{h}+u(x)\frac{v(x)-v(x+h)}{h}}{v(x+h)v(x)}. \] Thus in the limit as \(h\) tends to zero \[\frac{\mathrm{d} y}{\mathrm{d} x} = \lim\limits_{h\to0}\frac{y(x+h)-y(x)}{h} = \frac{v(x)\frac{\mathrm{d} u}{\mathrm{d} x} - u(x)\frac{\mathrm{d} v}{\mathrm{d} x}}{v(x)^2} \]

This is the formula for the differentiation of a quotient.

Note that for the product formula it is up to you which part of the product you call \(u\) and which \(v\), but that for the quotient formula, the denominator of the quotient must be \(v\) and the numerator must be \(u\).

There is an alternative way to derive this formula. Since \[ y = \frac{u(x)}{v(x)} = u(x)v(x)^{-1} \] and since \(v(x)^{-1}\) is a composite of the function \(v(x)\) and the function \(x^{-1}\), we can use a combination of the product rule and the chain rule. So \[\begin{align*} \frac{\mathrm{d}(uv^{-1})}{\mathrm{d} x} &= u\frac{\mathrm{d}(v^{-1})}{\mathrm{d} x}+v^{-1}\frac{\mathrm{d} u}{\mathrm{d} x} = u\left(-1\times v^{-2}\frac{\mathrm{d} v}{\mathrm{d} x}\right) + v^{-1}\frac{\mathrm{d} u}{\mathrm{d} x}\\ &= \frac{\mathrm{d} u}{\mathrm{d} x}\frac{1}{v} - \frac{u}{v^2}\frac{\mathrm{d} v}{\mathrm{d} x} = \frac{v\frac{\mathrm{d} u}{\mathrm{d} x}-u\frac{\mathrm{d} v}{\mathrm{d} x}}{v^2}. \end{align*}\]

Example 2.7 Differentiate \(y=\frac{3x^2+2}{(4x^2-4)^2}\) with respect to \(x\).

Solution. Let \(u = 3x^2+2\) and \(v = (4x^2-4)^2\). Then \[ \frac{\mathrm{d} u}{\mathrm{d} x} = 6x\text{ and }\frac{\mathrm{d} v}{\mathrm{d} x} = 2(4x^2-4)\times8x = 16x(4x^2-4) \] and so \[ \frac{\mathrm{d} y}{\mathrm{d} x} = \frac{v\frac{\mathrm{d} u}{\mathrm{d} x}-u\frac{\mathrm{d} v}{\mathrm{d} x}}{v^2} = \frac{(4x^2-4)^26x - (3x^2+2)16x(4x^2-4)}{((4x^2-4)^2)^2} = \frac{6x(4x-4)-16x(3x^2+2)}{(4x^2-4)^3}. \]

Example 2.8 Differentiate \(y=\frac{1-\sin(x)}{1+\sin(x)}\) with respect to \(x\).

Solution. Let \(u = 1-\sin(x)\) and \(v = 1+\sin(x)\). Then \[ \frac{\mathrm{d} u}{\mathrm{d} x} = -\cos(x)\text{ and }\frac{\mathrm{d} v}{\mathrm{d} x} = \cos(x) \] and so \[ \frac{\mathrm{d} y}{\mathrm{d} x} = \frac{v\frac{\mathrm{d} u}{\mathrm{d} x}-u\frac{\mathrm{d} v}{\mathrm{d} x}}{v^2} = \frac{(1+\sin(x)(-\cos(x))-(1-\sin(x))(\cos(x))}{(1+\sin(x))^2} = \frac{-2\cos(x)}{(1+\sin(x))^2}. \]