# Flight and Fight

Back in 2010 I, and 12 million other people, became slightly addicted to a little game called Angry Birds.  I stopped playing after a couple of months, like I always do with these things, not sure what happened to it then, probably petered out like so many other overnight success stories.

The premise of the game was to get your little birds to destroy some nasty green piggies who were stealing your eggs by launching them from a slingshot at the pigs’ defences.  I can see why those birds were angry, I would be if I were repeatedly being launched, projectile-style, at towers of wood and ice and stone.  That’s gotta hurt.

The programmers use some fairly simple mathematics to get those birds to move in a realistic way.  You intuitively expect the birds to move through the air in the way they do because all objects move like that, unless some force causes them to change their path.  Picture it now – imagine throwing a tennis ball, what shape does the path of the ball take? What about a diver jumping off a diving board, or a bullet flying through the air, or water spouts from a fountain?

They all follow this same path, the shape of which is a parabola.  A parabola is also the shape of a quadratic graph, something with equation like this:

$y=2x^{2}+3x-1$

or simply this:

$y=x^{2}$

The key thing is that an equation of the form $y=ax^{2}+bx+c$, where a, b, and c are any number is a quadratic equation whose graph is a parabola.  So why do these two situations produce the same shape of graph?  It was Galileo who first experimented and noted that motion is parabolic, but it wasn’t until Newton chimed in with his Laws of Motion that we had a formal mathematical model.

What happens is this.  When there is no acceleration, we know that $\text{speed}=\frac{\text{distance}}{\text{time}}$.  However, if we are accelerating, which is obviously much more common, then the start and end speeds will differ.  Let’s assume for now that our acceleration doesn’t change (because it doesn’t for projectiles, more on this in a bit), the formula becomes $\text{average speed}=\frac{\text{distance}}{\text{time}}$.

We mathematicians aren’t too keen on lots of words, so we’ll call the initial velocity (speed) u and the final velocity v.  To confuse things a little, we call our distance travelled s (this comes from the Latin “spatium” meaning distance or space), but we’ll stick with t for time.  The formula looks like this:

$\frac{u+v}{2}=\frac{s}{t}$.

We can generate another equation, using the fact that acceleration (a) is the change in speed per unit of time, giving us:

$a=\frac{v-u}{t}$.

Now, we combine these two equations and do some rearranging (a nice little task for you if you’re so inclined) to get a beautifully useful equation:

$s=ut+\frac{1}{2}at^{2}$.

This is so great because it means if we know the speed of launching (u)the time of travel (t) and our acceleration (a), we can calculate how far we will go.  Do you notice anything about this equation?  Powers of t?  Yep, it’s quadratic!

We can take it even further as well.  Projectile motion is two-dimensional (things move horizontally and vertically at the same time). Using these equations and some trigonometry of right-angled triangles (yay, trigonometry again!) we can model the motion in both directions.  We need to know the angle the projectile is launched at (α, greek letter “alpha”) and that acceleration of objects is due to gravity, which pulls vertically downwards towards the centre of the earth at approximately 9.8m/s2.  This never changes, hence we can stick with our initial premise that acceleration is constant.  We use the letter g for this acceleration due to gravity, and g takes different values on different planets.

Now the equation for horizontal motion becomes:

$s_x = ut \cos \alpha$,

(note the absence of the acceleration term, for the reason mentioned above) and the equation for vertical motion becomes:

$s_y = ut \sin \alpha - \frac{1}{2}gt^2$.

The reason there is a negative sign is because gravity pulls down, whereas the launching is up.

If you can cope with even more algebra, we can also combine both of these equations into one, meaning if we only know the launch speed and angle then we can plot the motion of the object as it travels, this fabulous equation (replacing sx with x and sy with y) is:

$y = x\tan \alpha - \frac{gx^{2}}{2u^{2}\cos^{2} \alpha}$

What a beauty!  And this is the quadratic equation those angry birds are programmed to follow.  When you launch them you set an angle and an initial speed, what happens next is just maths.