## Visualizing Elementary Calculus: Graphs, Tangents, Derivatives

The derivative as the slope of a graph is standard fare, and it’s important for visualizing calculus.

### The Derivative as Slope

Let’s look at the graph of $y=x^2$.

If we take a point on this graph, for example (2,4), the y-value is the square of the x-value.

If look at a nearby point, those values have changed by $\textrm{d}y$ and $\textrm{d}x$ respectively. We can visualize those changes like this:

$\textrm{d}y$ and $\textrm{d}x$ are supposed to represent tiny changes, so we better bring the points in close to each other and zoom in. Any reasonable curve looks like a straight line when you zoom in on it enough, including this one. As far as these nearby points are concerned, $y = x^2$ is a line, and they are on it. That line is called the tangent line. Here it is:

The value of $\textrm{d}y/\textrm{d}x$ is the derivative of y with respect to x, but in this context it is also called the slope of the tangent line. So, the derivative of a function at a certain point is the slope of the tangent line that point.

If we zoom back out again, eventually the graph of $y = x^2$ no longer looks like a line; we can see its curvature. The tangent line tracks the graph for a while, but eventually diverges. The red line shown below is the tangent line to the parabola. The derivative of $x^2$ with respect to x is 2x, so the slope of this tangent line through (2,4) is $2x = 2*2 = 4$. To find the equation for tangent line itself, we choose the line with the specified slope that goes through the point. That would be $y = 4x-4$.

### Circle

Elementary geometry tells us that the tangent to a circle is perpendicular to the radius. Let’s combine this fact with some calculus.

If we have a circle at the origin, the slope to a point (x,y) on the circle is y/x.

The circle is given by $x^2 + y^2 = R^2$. Applying $\textrm{d}$ to both sides gives $2x\textrm{d}x + 2y\textrm{d}y = 0$ (because $\textrm{d}R = 0$). This simplifies to

$\frac{\textrm{d}y}{\textrm{d}x} = -\frac{x}{y}$

Which is the slope of the tangent line.

Since this is perpendicular to a line of slope y/x, we see that perpendicular lines have negative-reciprocal slopes, a fact familiar from algebra.

### Square Roots

If you want to estimate the square root of a number $n$, a good way is take a guess $g$, then average $g$ with $n/g$. For example, to find the square root of 37, guess that it’s 6, then take the average of 6 and 37/6.

$\frac{6 + 37/6}{2} = 6.0833$

The actual answer is about 6.0828. It’s close. To get closer, iterate.

$\frac{6.0833 + 37/6.0833}{2} = 6.08276256$

The actual answer, with more accuracy, is 6.08276253. So we’ve got 7 decimal places of accuracy after two iterations of guessing.

Calculus shows us where this comes from. We are estimating $\sqrt{n}$. That is a zero of $x^2 - n$. So we plot $y = x^2 - n$ (here, $n = 37$).

We don’t know where the zero is, but we know that $x = 6$ is near the zero. So we draw the tangent line to the graph at $x = 6$. This tangent is $y = 12x - 73$.

The tangent line tracks the parabola quite closely for the very short $\textrm{d}x$ from the point $x = 6$ to wherever the zero is. So closely that we can’t even see the difference there. Zoom in near the point (6,-1).

Now we see that the tangent line is a very good approximation to the parabola near the zero, so we can approximate the zero using the zero of the tangent line instead of the zero of the parabola. The zero of the tangent line is given by

$0 = 12x - 73$

$x = 6.0833$

This is our first new guess for the zero of the parabola. It’s off, but only by a tiny bit, as this even-more-zoomed picture shows. We’ve zoomed in so closely that the original point (6,-1) is no longer visible.

From here, we can iterate the process by drawing a new tangent line like this:

We’ve zoomed in even closer. The red line is the tangent that gave us our first improved guess of 6.0833. Next, we drew a new tangent (purple) to the graph (blue) at the location of the improved guess to get a second improved guess, which is again so close we can’t even see the difference on this picture, despite zooming in three times already.

This general idea of estimating the zeroes of a function by guessing, drawing tangents, and finding a zero of the tangent, is called Newton’s method.

### Exercises

1. Graph $y = \sin x$ and find the places where the tangent line slices through the graph, rather than lying completely above or below it near the point of tangency. What is unique about the derivative at these points? (Answer: the derivative is at a local minimum or maximum (i.e. the graph is steepest) when the tangent line slices through)
2. Find the slope of the tangent line to a point (x,y) on the ellipse $(x/a)^2 + (y/b)^2 = 1$ via calculus. Find it again by starting with the unit circle $x'^2 + y'^2 = 1$, for which you already know the slope of the tangent, and making appropriate substitutions for $x'$ and $y'$. (Answer: $\textrm{d}y/\textrm{d}x = -x/y * (b/a)^2$)
3. In this post, we found that $y = 4x - 4$ is tangent to $y = x^2$ at $(2,4)$. Confirm this without calculus by noting that there are many lines through (2,4), all with different slopes. The thing that singles out the tangent line is that it only intersects the parabola once. Any line through (2,4) with a shallower slope than the tanget will intersect the parabola at (2,4), but intersect again somewhere off to the left. Any line with a steeper slope will have a second intersection to the right. Use algebra to write down the equation for a line passing through (2,4) with unknown slope, and set its y-value equal to x^2 to find the intersections with the parabola. What slope does the line need to have so that there is only one such intersection?
4. Do the previous exercise over for a circle (i.e. use algebra to find the tangent line to a circle)
5. For any point outside a circle, there are two tangents to the circle that pass through the point. When are these tangents perpendicular? (Answer: When the point is on a circle with the same center and radius $\sqrt{2}$ as much)
6. Newton’s method of estimating zeroes gave the same numerical answer for the zero of $x^2 - 37$ as the algorithm for estimating square roots gave for $\sqrt{37}$. Show that this is always the case (i.e. perform Newton’s method on $y = x^2 -n$ with a tangent at some point $g$, and show that the new guess generated is the same as that given in the algorithm).
7. Use Newton’s method to estimate $28^{1/3}$ to four decimal places (Answer: 3.0366).