# Trigonometry/Power Series for e to the x
## Compound interest

What function satisfies
    $f(x)=f'(x)$ ?
That is, for what function is the rate of growth equal to the current value?
This kind of relationship where the rate of growth is proportional to the current value is the relationship underlying compound interest. If you're receiving compound interest on a sum of money and reinvest the income, the amount you get in a fixed time is proportional to the amount of money that you have at the start of that time. If you start with 2 units it goes to 4, then 8 then 16 then 32 and so on. So is
    $f(x)=2^{x}$
a good candidate for a function that satisfies the differential equation? If we approximately evaluate the slope at $x=0$ we get about 0.69. Some expression like $2^{x}$ looks promising, but 2 is too small a constant.
If we instead try
    $f(x)=3^{x}$
We find the slope at zero is about 1.09. 3 is too large a constant, but not by much. If this is going to work for some number $k$ so that $f(x)=k^{x}$ we will want that number to be between 2 and 3. We're not saying that it is possible, just that it looks a promising avenue to explore. It will turn out that there is a number that works.

## Power Series

We can try a completely different approach, as if we didn't know that raising some number to the power of $x$ is a good thing to try.
Suppose that $f(x)$ could be expressed as a power series, in terms of $x,x^{2},x^{3},\dots$ that is that:
    $f(x)=a_{0}+a_{1}x+a_{2}x^{2}+a_{3}x^{3}+a_{4}x^{4}+\cdots$
Then differentiating term by term, assuming that this all makes sense, we'd have:
    $f'(x)=a_{1}+2a_{2}x+3a_{3}x^{2}+4a_{4}x^{3}+5a_{5}x^{4}+\cdots$
For the differential relation to hold, equating corresponding coefficients term by term we'd need:
    $a_{1}=a_{0},a_{2}={\frac {a_{1}}{2}},a_{3}={\frac {a_{2}}{3}},a_{4}={\frac {a_{3}}{4}},a_{5}={\frac {a_{4}}{5}}$
And this will be so if we put:
    $a_{0}=1,a_{1}=1,a_{2}={\frac {1}{2!}},a_{3}={\frac {1}{3!}},a_{4}={\frac {1}{4!}},a_{5}={\frac {1}{5!}}$
Where $4!$ is the factorial function and means $1\times 2\times 3\times 4$ and similarly for other values.
In other words:
    $f(x)=1+{\frac {x}{1!}}+{\frac {x^{2}}{2!}}+{\frac {x^{3}}{3!}}+\cdots$
We now have to check that this formula makes some kind of sense.

## Convergence

The main problem is that we have an infinite sum. A sum like $1+3+9+27+81+\cdots$ is unbounded. Even a sum like $1+1+1+1+1+\cdots$ would be a problem for us. On the other hand, some sums are OK. If we look at
    $1+{\frac {1}{2}}+{\frac {1}{4}}+{\frac {1}{8}}+{\frac {1}{16}}+{\frac {1}{32}}+\cdots$
We can see this is well behaved, and if we go far enough it gets as close to 2 as we like.
Let us put $x=10$ in
    $f(x)=1+{\frac {x}{1!}}+{\frac {x^{2}}{2!}}+{\frac {x^{3}}{3!}}+\cdots$
At first this does not look very promising.
    $f(10)=1+{\frac {10}{1!}}+{\frac {100}{2!}}+{\frac {1000}{3!}}+\cdots$
    $f(10)=1+10+50+166.666+\cdots$
The terms are getting bigger, and we appear to be in a worse situation than $1+1+1+1+1+\cdots$
However, we are being too hasty. Whilst in each term the numerator is $x^{n}$ the denominator is $n!$ . The amount the numerator is multiplied by as we move right one term is $x$ , which is 10 in our case. The amount by which the denominator is being multiplied as we move right one term is however increasing. By the time we get to the twenty first term we have $10^{20}$ divided by $20!$ . The numerator of the next term is 10 times bigger and the denominator is 21 times bigger. So from the 22nd term onwards each term is less than half the size of the term before it!
With $x=10$ , the sum of all the terms from the 22nd term onwards is not going to go off to infinity. In fact that sum must be less than twice the twenty second term. If we add in the first twenty one terms too, we are still not going to go off to infinity.
We have just shown that if we plug the value $x=10$ into the equation we get a finite sum, and the sum makes sense. It might be some work to calculate it, but we can get as close as we like by going far enough along the sum. That wouldn't be so if the sum went off to infinity. Almost exactly the same argument works for $x=100$ or any other positive value we choose, though for larger values we have to go further before the terms start halving or better.
Negative values of $x$ also work, but introduce a very slight technical complication. One way to handle it is to rely on the alternating sum:
    $1-{\frac {1}{2}}+{\frac {1}{4}}-{\frac {1}{8}}+{\frac {1}{16}}-{\frac {1}{32}}+\cdots$
being well behaved. It sums to ${\frac {2}{3}}$ , or in other words we can get as close as we like to the value ${\frac {2}{3}}$ by going far enough.
What we have just seen is that the formula:
    $f(x)=1+{\frac {x}{1!}}+{\frac {x^{2}}{2!}}+{\frac {x^{3}}{3!}}+\cdots$
Makes sense for all values of $x$ , whether positive or negative. It also makes sense for x=0 when it evaluates to 1.

## Does Differentiation Term by Term Make Sense?

If
    $f(x)=1+{\frac {x}{1!}}+{\frac {x^{2}}{2!}}+{\frac {x^{3}}{3!}}+\cdots$
Does it make sense to differentiate it term by term and write:
    $f'(x)=0+1+{\frac {x}{1!}}+{\frac {x^{2}}{2!}}+{\frac {x^{3}}{3!}}+\cdots$
Notice that what we have done here is, for example, differentiate $x^{3}$ to $3x^{2}$ and then cancel the 3 with a 3 in the '3!' to make it '2!'.
Certainly if we take the first 1000 terms of $f(x)$ , then we just have a polynomial, and differentiating the polynomial term by term is fine. We'll then have the first 999 terms of what we claim is $f'(x)$ . Unfortunately we have to be a little careful. Just because our error in approximating f(x) is small it does not immediately follow that our error in estimating $f'(x)$ is small too.
* Small function with big derivative
* Consider the function
* $g(x)={\frac {\sin {\bigl{\frac {1}{x}}{\bigr )}}{10,000}}$
* Because $1\leq \sin(x)\leq 1$ the function is small, but close to x=0 its derivative gets very big. Use the chain rule to differentiate g(x) and calculate its derivative for $x$ is one millionth.
* Can $g'(x)$ be more than a million times bigger than $g(x)$ for this function?

## Exponential function

missing proper intro
    $e^{x}=1+{\frac {x}{1!}}+{\frac {x^{2}}{2!}}+{\frac {x^{3}}{3!}}+\cdots =\sum _{n=0}^{\infty }{\frac {x^{n}}{n!}}$