text: ## Calculus: The Derivative
  
  Since I am finally TAing for a calculus class it seemed like a good time to write about this topic. Unfortunately I still can’t make nice pictures and a good visualization is extremely useful in intuitively understanding calculus.
  
  Before taking calculus students are taught the equations which represent lines on a graph, i.e. $y = mx+b$. The letter “m” represents the important information, the slope of the line. The slope is just how quickly the line rises compared to how far across it goes. A line with slope 2, would go up 2 units for every 1 unit it moved to the right. A line with slope $\frac{5}{13}$ would move up 5 units for every 13 units it moves to the right. Hence the familiar idea of “rise over run.”
  
  Higher slopes indicate steeper lines. This is because the line is rising much faster than it is moving to the right. Negative slope just means going to the down and to the right. A line with slope -5 will move down 5 units and to the right one unit.
  
  After learning how to graph, students will typically learn a bunch of other seemingly random stuff, but slope is actually the most important idea. One of the random things is the mysterious function called the “difference quotient.” The difference quotient involves a starting function, f(x), and doing what seems like an arbitrary mash up of things.
  
  Given a function f(x), the difference quotient of f(x) is the function, $\frac{f(x+h)-f(x)}{h}$. It looks like gibberish to the untrained eye but it is secretly the slope, and here’s why.
  
  First, $f(x+h)$ means to replace x with “x+h” in the function f(x). For example, if the function was $f(x) = \sin(x)$ then $f(x+h) = sin(x+h)$. Replacing the input with “x+h” is supposed to represent plugging in slightly more than x into the function. More precisely, plugging in “h more than x”.
  
  For example if $f(x) = x^2 + 5$ then $f(1) = 6$ and $f(1+h) = (1+h)^2 + 5 = 1 + 2h + h^2 + 5 = 6 + 2h + h^2$. The idea here is that adding just a little more to 1, namely h, affects the function much differently than simply adding h to the end result, 6. In fact we can see here that by adding h into the input of the function, we get in general $f(x+h) = x^2 + 2xh + h^2 + 5$. So again, adding h into the input, can have a drastic affect on the output.
  
  Now that we understand $f(x+h)$ we can look closely at $f(x+h) - f(x)$. Again, starting with an example makes it easier to see.
  Let $f(x) = x^2 + 5$ and lets use an actual x and an actual h. How about, $x = 5$ and $h = 1$. Then we get:
  $f(x+h) -f(x)= f(5 + 1) -f(5)$ and stop there. We are just subtracting two outputs, aka two y-values. This should remind you of calculating the slope between two points, $\frac{f(x_1)-f(x_2)}{x_1-x_2}$. Here the first point is given, and the second point comes from adding a little bit more to the first point, (h more).
  
  Right now we have $f(x+h)-f(x)$ and to get a slope equation we need to divide by the two inputs subtracted, just like with the slope between two points we subtract the two x-values in the denominator. Well what are the two inputs here? “x+h” and “x”. Therefore, the slope between the two points $(x,f(x))$ and $(x+h,f(x+h))$ is given by
  $\frac{f(x+h)-f(x)}{x+h-x} = \frac{f(x+h)-f(x)}{h}$ This is the difference quotient! So this mysterious equation was secretly the slope equation written in a special way all along. It will become clear later why we write it in this way, but for now just know that it is the slope between the points, $(x,f(x))$ and $(x+h,f(x+h))$.
  
  Students don’t typically dissect this formula in a good way so they just forget about it. Then much later they learn about the idea of limits, which really should be shown right after slope. Limits can take a lot of rigorous explaining which I won’t go through. Instead I will talk about them in a very informal way.
  
  Think of a function, represented by a graph, as “moving” as you plug in values. As you plug in $x= 1,2,3,4...$ what is happening to the graph? For something simple like a line, $f(x) = 2x+1$ you can easily visualize as the input x moves left and right, that the line follows what it should. The idea of seeing what happens to the function as the input x moves around is what limits are all about.
  
  We represent this with the following notation, $\lim_{x \rightarrow c} f(x)$. This means, “the limit of f(x) as x approaches c”. We are looking at what the function does, as the inputs approach some value c. Note that we don’t care what actually happens when plugging c into f(x), but rather we care about what the function is doing as the input gets close to the value c. The typical example is a piece-wise function, i.e. a function that consists of putting other functions together. We can have functions approach some limit, L, as the inputs approach something, c, but the actual value of the function at c, f(c), is not equal to L. This can be hard to grasp and leads to the idea of continuity, but that is a topic for another time. So instead of worrying about that, just think of limits of functions as what happens to outputs as the input goes toward a certain number.
  
  So, they teach you this thing called the difference quotient, and then they later teach you this idea of limits. The logical step is to put the two topics together in a smart way.
  
  What happens to $\frac{f(x+h)-f(x)}{h}$ when we move h around? Consider x as just some number, and we are not moving it around. It is immovable. Think of x as a fixed point and we add the value h to it. Well, we already know that the difference quotient will give us the slope between the two points $(x,f(x))$ and $(x+h,f(x+h))$. What happens when we make h get smaller and smaller? This means we are adding less and less to the fixed point x. This corresponds to the slope of two points, where the second point is getting closer to the stationary one. Now imagine we keep making h smaller and smaller, in fact we want to make it as small as possible. We can’t make it be exactly zero, or else we would be dividing by zero. However, we can take the limit of the function as h goes toward zero. This would be written as:
  $\lim_{h \to 0} \frac{f(x+h)-f(x)}{h}$
  When h goes to zero, we can think of the second point, $(x+h,f(x+h))$ as actually right on top of the point $(x,f(x))$. So if we could actually take this limit to when h becomes zero, we would get the slope of two points which are actually the same point. Thus we magically have the slope of a line going through a single point instead of two points! Note I said “if we could actually take this limit.” This is because the limit does not have to exist in the first place, but when it does we have this neat idea of a slope of a line going through a single point.
  
  This slope is tied to the original function we started with. So it’s not exactly just a slope of a line going through some random point, but instead is the slope of a line related to f(x). We have a special way of saying what this thing is. It is the slope of the line tangent to the graph, at the point x. A tangent line is a line that barely touches the graph once (a topic for another day).
  
  In practice what happens is that you are given some function. Then you get the difference quotient and if it is a “good” function you will be able to manipulate it in a way that gets rid of the h in the denominator. Assuming you do mathematically correct manipulations (multiply by 1 or add zero) the end result will have the same limit that the non manipulated equation had. Then because it no longer has the risk of zero being the denominator, you will be able to plug in $h = 0$ directly to find the exact limit as h approaches zero.
  
  After doing this entire process we finally have what is known as the derivative of a function!
metadata: {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 33, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}