Fi & Lu  Area  Algebra Trigonometry  Functions  Complex Numbers  Calculus

Fi and Lu conquer calculus

Fi liked the pretty curves that she saw when tackling trigonometry. She imagined skiing on those curves, speeding up on the downslopes and slowing down on the upslopes. Lu realized that the steepness of the slopes could be measured by looking at nearby points. Mom said that this was called differentiation. “You can draw a tangent to the curve at a point—a straight line that just touches the curve at that point. The slope of that tangent is just how much it goes up for each unit it goes forward. You can approximate the tangent by taking two points on the curve very close to each other and drawing a line between them. As the two points get closer together, they provide a better approximation to the tangent. (Click the plot below.)

“For a function \(f(x)\), we can define the derivative of \(f(x)\) with respect to \(x\), the function that gives the slope of the tangent to \(f(x)\) at each point \(x\), as \[\frac{df(x)}{dx} = \lim_{\delta\rightarrow 0} \frac{f(x+\delta)-f(x)}{\delta}\] “This is a standard notation for derivative, but it’s a bit strange. The \(d\) should not be considered as a separate entity, but as paired with the thing that follows it. And that’s why the derivative of a derivative, called the second derivative is written as \[\frac{d^2f(x)}{dx^2}\] “It’s not much of a stretch to see that \[f(x+\delta) = f(x) + \frac{df(x)}{dx}\delta + o(\delta)\] where \(o(\delta)\) means some function \(h\) such that \[\lim_{\delta\rightarrow 0}\frac{h(\delta)}{\delta} = 0\] “From these definitions, we can deduce some properties of derivatives: \begin{align*}\frac{d(f(x)+g(x))}{dx} &= \lim_{\delta\rightarrow 0} \frac{f(x+\delta)+g(x+\delta)-f(x)-g(x)}{\delta} \\ &= \lim_{\delta\rightarrow 0} \frac{f(x+\delta)-f(x)}{\delta} + \lim_{\delta\rightarrow 0} \frac{g(x+\delta)-g(x)}{\delta}\\ &= \frac{df(x)}{dx} + \frac{dg(x)}{dx}\end{align*} \begin{align*}\frac{d(f(x)g(x))}{dx} &= \lim_{\delta\rightarrow 0} \frac{f(x+\delta)g(x+\delta)-f(x)g(x)}{\delta} \\ &= \lim_{\delta\rightarrow 0} \frac{(f(x)+\frac{df(x)}{dx}\delta+o(\delta))(g(x)+\frac{dg(x)}{dx}\delta+o(\delta))-f(x)g(x)}{\delta} \\ &= \lim_{\delta\rightarrow 0}\frac{f(x)g(x)+f(x)\frac{dg(x)}{dx}\delta+\frac{df(x)}{dx}g(x)\delta+o(\delta)-f(x)g(x)}{\delta} \\ &= f(x)\frac{dg(x)}{dx}+\frac{df(x)}{dx}g(x)\end{align*} \begin{align*}\frac{d(f(g(x))}{dx} &= \lim_{\delta\rightarrow 0} \frac{f(g(x+\delta))-f(g(x))}{\delta} \\ &= \lim_{\delta\rightarrow 0} \frac{(f(g(x)+\frac{dg(x)}{dx}\delta+o(\delta))-f(g(x))}{\delta} \\ &= \lim_{\delta\rightarrow 0}\frac{f(g(x))+\frac{df(g(x))}{dg(x)}\left(\frac{dg(x)}{dx}\delta+o(\delta)\right)-f(g(x))}{\delta} \\ &= \frac{df(g(x))}{dg(x)}\frac{dg(x)}{dx}\end{align*} ”Let’s tackle a few examples. When we talked about polynomials, we defined the derivative and said that the definition would make sense when we covered calculus. Well, \[d(x^n)/dx = \lim_{\delta\rightarrow 0} \frac{(x+\delta)^n-x^n}{\delta} = \lim_{\delta\rightarrow 0} \frac{x^n + n\delta x^{n-1} + o(\delta) - x^n}{\delta} = nx^{n-1}\] “Another example that comes to mind is \(b^x\). \[\frac{d(b^x)}{dx} = \lim_{\delta\rightarrow 0} \frac{b^{x+\delta}-b^x}{\delta} = \lim_{\delta\rightarrow 0} \frac{b^x (b^\delta-1)}{\delta} = b^x \lim_{\delta\rightarrow 0} \frac{b^\delta-1}{\delta}\] “But what is that last limit? There’s some \(b\) for which that limit is 1; let’s call that number \(e\). We’ll write \(\ln\) for \(\log_e\) and call \(\ln\) the natural logarithm, and say that \(e\) is the base of natural logarithms. Then we have \[\frac{d(e^x)}{dx} = e^x\] and so \[\frac{d(b^x)}{dx} = \frac{d(e^{x\ln b})}{dx} = \frac{d(e^{x\ln b})}{d(x\ln b)} \frac{d(x\ln b)}{dx} = e^{x\ln b} \ln b = b^x \ln b\] “A question that comes to mind is what is the derivative of \(\ln x\)? Well \[ 1 = \frac{dx}{dx} = \frac{d(e^{\ln x})}{dx} = \frac{d(e^{\ln x})}{d(\ln x)}\frac{d(\ln x)}{dx} = e^{\ln x}\frac{d(\ln x)}{dx} = x \frac{d(\ln x)}{dx}\] so \[\frac{d(\ln x)}{dx} = \frac{1}{x}\] “As another example, we can use our knowledge of trigonometry to compute the derivative of \(\sin x\): \begin{align*}\frac{d(\sin x)}{dx} &= \lim_{\delta\rightarrow 0} \frac{\sin(x+\delta)-\sin x}{\delta} \\ &= \lim_{\delta\rightarrow 0} \frac{\sin x \cos\delta + \cos x \sin\delta-\sin x}{\delta} \\ &= \lim_{\delta\rightarrow 0} \frac{\cos x \sin\delta-(1-\cos\delta)\sin x}{\delta}\end{align*} “We can notice that \(1-\cos\delta = (1-cos^2\delta)/(1+\cos\delta) = \sin^2\delta/(1+\cos\delta)\). We know that \(\sin 0 = 0\) and \(\cos 0 = 1\), while \(\lim_{\delta\rightarrow 0} \frac{\sin\delta}{\delta} = 1\), so we see that \begin{align*}\frac{d(\sin x)}{dx} &= \lim_{\delta\rightarrow 0} \frac{\cos x \sin\delta-(1-\cos\delta)\sin x}{\delta} \\ &= \lim_{\delta\rightarrow 0} \frac{\cos x \sin\delta-\frac{\sin^2\delta}{1+\cos\delta}\sin x}{\delta} \\ &= \left(\cos x - \frac{\sin 0}{1+\cos 0} \sin x\right) \lim_{\delta\rightarrow 0} \frac{\sin\delta}{\delta} \\ &= \cos x\end{align*} “We can then easily compute the derivative of \(\cos x\): \[\frac{d(\cos x)}{dx} = \frac{d(\sin(\frac{\pi}{2}-x))}{dx} = \frac{d(\sin(\frac{\pi}{2}-x))}{d(\frac{\pi}{2}-x)}\frac{d(\frac{\pi}{2}-x)}{dx} = \cos(\frac{\pi}{2}-x)(-1) = -\sin x\] “And now we can compute the derivative of \(\tan x\): \[\frac{d(\tan x)}{dx} = \frac{d((\sin x) (\cos x)^{-1})}{dx} = (\cos x) (\cos x)^{-1} + (\sin x) (-(\cos x)^{-2}) (-\sin x) = 1 + \tan^2 x\] “And this allows us to compute the derivative of the inverse of \(\tan x\), called \(\arctan x\), the angle whose tangent is \(x\): \[1 = \frac{dx}{dx} = \frac{d(\tan(\arctan x))}{dx} = (1+(\tan(\arctan x))^2)\frac{d(\arctan x)}{dx} = (1+x^2)\frac{d(\arctan x)}{dx}\] so \[\frac{d(\arctan x)}{dx} = \frac{1}{1+x^2}\]

Taylor series

“Suppose we have a function that can be expressed as an infinite series about a point \(c\): \[f(x) = \sum_{n=0}^\infty a_n (x-c)^n\] “Writing the nth derivative of \(f\) at the point \(c\) as \(f^{(n)}(c)\), we see that \[f^{(n)}(c) = n!a_n\] so \[a_n = \frac{f^{(n)}(c)}{n!}\] “Applying this to \(e^x\), \(\sin x\), and \(\cos x\), with \(c=0\), we get \[e^x = \sum_{n=0}^\infty \frac{x^n}{n!}\] \[\cos x = \sum_{n=0}^\infty (-1)^n\frac{x^{2n}}{{2n}!}\] \[\sin x = \sum_{n=0}^\infty (-1)^n\frac{x^{2n+1}}{(2n+1)!}\] “Substituting complex quantities, where \(i^2=-1\), we can match terms to see that \[e^{ix} = \cos x + i\sin x\] \[\cos x = \frac{e^{ix}+e^{-ix}}{2}\] \[\sin x = \frac{e^{ix}-e^{-ix}}{2i}\] “We can attempt to get the Taylor series for \(\ln (1-x)\), finding \[\ln (1-x) = -\sum_{n=1}^\infty \frac{x^n}{n}\] but it’s fairly clear that this can’t work for \(|x|>1\), since the sum diverges, and logs of negative numbers aren’t real.

“We can do the same thing for \(\arctan x\), but it’s actually easier to first expand \(\frac{1}{1+x^2}\) as a power series by direct division and then ask what that’s the derivative of: \[\frac{1}{1+x^2} = \sum_{n=0}^\infty (-1)^n x^{2n}\] \[\arctan x = \sum_{n=0}^\infty (-1)^n \frac{x^{2n+1}}{2n+1}\] “Just as with \(\ln (1-x)\), this can’t work for \(|x|>1\), as the sum diverges. But for \(x=1\), it gives a series for \(\frac{\pi}{4}\). Sadly, this converges very slowly, but the tangent addition formula can be used to find faster formulas using arctan. In 1706, John Machin used \(\frac{\pi}{4} = 4\arctan\frac{1}{5} - \arctan\frac{1}{239}\) to calculate a hundred digits of \(\pi\). Of course, now we have computers as well as much faster algorithms.”

Antiderivatives and Integrals

“When we asked what that’s the derivative of, we were looking for an antiderivative, i.e., a function whose derivative is the function in question. We glossed over the fact that adding any constant to an antiderivative is also an antiderivative of the same function, so we should have been more careful when we identified \(\arctan x\) with its series, by noting that \(\arctan 0 = 0\). Unsurprisingly, the process of finding antiderivatives is called antidifferentiation.

“Antiderivatives are also known as indefinite integrals, and antidifferentiation is also known as integration. To explain this, let me tell you about integrals. If we have a plot of a function \(f(x)\), we can ask for the area between the x axis and the function, say between \(x=a\) and \(x=b\). This is called a definite integral, and is written as \(\int_a^b f(x)\, dx\). You can think of this as combining (integrating) an infinite number of infinitely thin slices that form the area. To clarify, the area is a signed quantity, positive when \(f(x)>0\) and negative when \(f(x)<0\), but the opposite if \( b < a \). It should be clear that \(\int_a^b f(x)\, dx + \int_b^c f(x)\, dx = \int_a^c f(x)\, dx\).

“What you may notice is that if \(f\) doesn’t change very much between a and b, the integral can be approximated by a trapezoid with area \((b-a)(f(a)+f(b))/2\). A more formal way of saying this is that \(\int_a^{a+\delta} f(x)\, dx = (f(a)+o(\delta))\delta\) as long as \(f(a+\delta) = f(a) + o(\delta)\).

“If you see how the area changes as you move \(a\) or \(b\) (try it!), you can see the connection with derivatives: \[\frac{d}{db}\int_a^b f(x)\, dx = \lim_{\delta\rightarrow 0}\frac{\int_a^{b+\delta}f(x)-\int_a^b f(x)}{\delta} = \lim_{\delta\rightarrow 0}\frac{\int_b^{b+\delta}f(x)}{\delta} = \lim_{\delta\rightarrow 0} \frac{f(b)+o(\delta)\delta}{\delta} = f(b)\] “In other words, the derivative of the integral of a well-behaved function is the function itself. Normally, we write this fact with an indefinite integral: \[\frac{d}{dx}\int f(x)\, dx = f(x)\]

“When \(f(x)\) has a derivative, it’s also true that \[\int\frac{df(x)}{dx}\, dx = f(x) + C\\\] as you might see by taking the derivative of both sides. \(C\) could be any constant. When we know the indefinite integral of a function, we can evaluate a definite integral of that function by subtracting the values of the indefinite integral at the endpoints:\[\text{if}\quad \int f(x)\, dx=F(x)+C \qquad\text{then}\qquad \int_a^b f(x) = F(b)-F(a) \qquad\text{which we often write as}\quad \left. F(x)\right \rvert_a^b\]

“We’ll end this section with a few facts about integrals; we’ll elide the constant \(C\) for clarity. A couple are rather obvious:\[\int c f(x)\, dx= c \int f(x)\, dx\qquad \text{and}\qquad\int (f(x)+g(x))\, dx = \int f(x)\, dx + \int g(x)\, dx\] and some a bit less so: \[f(x)g(x) = \int \frac{d(f(x)g(x))}{dx}\, dx = \int \left(f(x)\frac{dg(x)}{dx} + \frac{df(x)}{dx}g(x)\right)\, dx = \int f(x)\frac{dg(x)}{dx}\, dx + \int \frac{df(x)}{dx}g(x)\, dx\] but is often used when one of the integrals on the right hand side is easier to evaluate than the other.”