# Why I Can See My Car works

A few weeks ago, the Mathematical Ninja revealed that they integrated trigonometric functions using a cheap mnemonic. As reader Joshua Zucker pointed out, this was *most* unlike the Mathematical Ninja. Had they been kidnapped? Surely not; no Ninja would ever be taken alive. Had the Mathematical Pirate infiltrated? Had someone just been in a hurry to churn out an article before going on holiday? The truth may never be known.

However, one truth is available: the reasons behind the functions $\sin$ and $\cos$ behaving as they do under integration. There are many reasons. Here are several.

### 1: Maclaurin series

The Mathematical Ninja would, no doubt, call them Euler series. They have, in the past, corrected me on it. It doesn’t matter, though.

The Maclaurin series for $\sin$ is that $\sin(x) = x - \frac{x^3}{3!} + \frac{x^5}{5!} - … + (-1)^{k} \frac{x^{2k+1}}{(2k+1)!} + …$

For $\cos$, it’s $\cos(x) = 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - … + (-1)^k \frac{x^{2k}}{2k!} + …$

Where those come from is another post in itself, but the key thing is what happens when you integrate, say, the $\cos$ expression.

You get $\int \cos(x) dx = x - \frac{x^3}{3 \times 2!} + \frac{x^5}{5 \times 4!} - … + (-1)^{k} \frac {x^{2k+1}}{(2k+1)!} + … $ - which is precisely the expression for $\sin(x)$ ((give or take an arbitrary constant)) !

Integrating $\sin$ gives $\int \sin(x) dx = \frac{x^2}{2} - \frac{x^4}{4 \times 3!} + \frac{x^6}{6 \times 5!} - … + (-1)^{k} \frac {x^{2k+2}}{(2k+2)!} + …$ - which is $\cos(x)$, although the 1 has been subsumed into a constant. Also, there’s a bit of guddling still to do with the general term with all the $k$s in, but it all works out.

### 2: Imaginary numbers

If you’re lucky enough to be doing Further Pure, you might have come across the functions $\sinh$ and $\cosh$, defined in terms of exponentials. $\sinh(x)$, for instance, is $\frac{e^x - e^{-x}}{2}$; $\cosh$ is the same thing with a plus in between. It turns out that $\sin$ and $\cos$, with a bit of imagination, can be written in the same form:

$\sin(x) \equiv \frac{e^{ix} - e^{-ix}}{2i}$ and $\cos(x) \equiv \frac{e^{ix} + e^{-ix}}{2}$

If you can put aside mental tortures and treat $i$ like the constant it is, you can see that integrating $\sin(x)$ gives you $\frac{\frac{e^{ix}}{i} - \frac{e^{-ix}}{-i}}{2i}$ which, obviously… pardon? Oh.

OK, let’s tidy that up: multiply top and bottom by $i$ to get $\frac{e^{ix} + e^{-ix}}{2i^2}$ - which is, of course, $\cos(x)$. You can do something very similar with $\cos$, but I’m fed up of typing the fractions.

### 3: Antiderivatives

The last reason is probably the most obvious: if $\sin(x)$ differentiates to $\cos(x)$, the integral of $\cos(x)$ must be $\sin(x)$. But is it?

Well, of course it is. You can show that using the definition of a derivative and a compound angle formula.

The derivative of $f(x)$ is defined as the limit, as $h$ becomes 0, of $\frac{f(x+h) - f(h)}{h}$. In the case of $\sin(x)$, that gives $\frac{\sin(x+h) - \sin(x)}{h}$, which works out to $\frac{\sin(x)\cos(h) + \cos(x)\sin(h) - \sin(x)}{h}$.

Here, it gets tricky. As $h$ gets small, $\cos(h)$ gets as close as you like to 1. Meanwhile, $\sin(h)$ gets closer and closer to… $h$, as the Mathematical Ninja would tell you.

So, the top becomes $\frac{\sin(x) + h \cos(x) - \sin(x)}{h}$. That’s good: there’s a $\sin(x)$ and a $-\sin(x)$ that obliterate each other to leave $\frac{h \cos(x)}{h}$ - and the $h$s cancel to leave $\cos(x)$. Phew!

The Mathematical Ninja has been warned that their cloak is on a shoogly hook, and that they’d better buck their ideas up in the future.

* Updated 2021-03-08 to give the Ninja their correct gender.