You can now subscribe to Trevor Pythagoras for free by email, just click the link below. Subscribe to Trevor Pythagoras by email

## Taylor Series with example cos(x)

The Taylor series is the general case of the Maclaurin Series for calculating the value of a function. It enables you calculate the value of a function at any point if you can find the value of the function and and all its derivatives at any point. This is done as a power series. The series is as follows:

$f(x) = \sum^{\infty}_{n=0} \frac{f^{(n)}(x-a)^n}{n!} = f(a) + \frac{f^{(1)}(a)(x-a)}{1} + \frac{f^{(2)}(a)(x-a)^2}{2!} + \frac{f^{(3)}(a)(x-a)^3}{3!} + ...$

The series is said to be taken about $a$ meaning we calculate the derivatives of the function at the point a and then from these we find the value of the function. Because the series is infinite we can never find the value of the function exactly but we can give it to any required degree of accuracy by taking the first i terms of the series. The Maclaurin Series is just the Taylor series about 0.

### Example cos(x)

An example of the Taylor series is to find a power series for cos(x). We can choose to do this about any value of a so in this example we will use $a = \frac{\pi}{2}$. In this example we will look at the first 2 no zero terms.

The first we need to find the value of the derivatives and the function at pi/2.
The first one is:
$cos(\frac{\pi}{2}) = 0$

We now need to differentiate the function to get:
$\frac{d}{dx} cos(x) = -sin(x)$
and then take its value at $\frac{\pi}{2}$ which is:
$-sin({\pi}{2}) = -1$

Similarly for the second term we differentiate again to find the second derivative is:
$\frac{d}{dx} (-sin(x)) = -cos(x)$
so at pi/2 this is
$-cos(\frac{\pi}{2}) = 0$

Since the last term was zero we need to find the next one which is:
$\frac{d}{dx} (-cos(x)) = sin(x)$
so $sin(\frac{\pi}{2}) = 1$

Now we have found all the values of the function and its derivative we need for the level of accuracy required we can simply put these values into the series to get

$cos(x) = 0 + (-1)(x-\frac{\pi}{2}) + \frac{0(x-\frac{\pi}{2})^2}{2!} + \frac{1(x-\frac{\pi}{2})^3}{3!} + ...$
$cos(x) = -(x-\frac{\pi}{2}) + \frac{(x-\frac{\pi}{2})^3}{3!} - ...$

To test this we can try $x = \frac{\pi}{3}$
$cos(\frac{\pi}{3}) = -(\frac{\pi}{3}-\frac{\pi}{2}) + \frac{(\frac{\pi}{3}-\frac{\pi}{2})^3}{3!} - ...$
$cos(\frac{\pi}{3}) = 0.49967$
which is close to the 1/2 it really is.

Categories: algebra, calculus, maths

## Fermat’s Last Theorem

Fermat was a 17th century mathematician who provided a number of theorems and some of their proofs. The most intriguing of hi theorems is Fermat’s Last Theorem which is as follows:

the equation
$x^n + y^n = z^n$
has no integer (whole number) solutions for n>2

For example a solution for n=2 is x=3, y=4, z = 5 since
$3^2 + 4^2 = 9 + 16 = 25 = 5^2$
however the theorem states that for any n larger than 2 a set of integer solutions such as these cannot be found.

Despite the simplicity of this theorem it took 300 years until 1994 for it to be solved by Andrew Wiles using advanced maths.

A fascinating book on the problem is called Fermat’s Last Theorem (by Simon Singh) which goes through the history of the problem and many of the people who have attempted to solve it.

Categories: maths

## Compound tan – tan(A+B)

We can use expressions for cos(A+B) and sin(A+B) to help us find tan(A+B).

Using the identity tanx = sinx / cosx we can write

$tan(A+B) = \frac{sin(A+B)}{cos(A+B)}$

we can now substitue in
sin(A+B) = sinAcosB + sinBcosA
and
cos(A+B) = cosAcosB – sinAsinB
to get

$tan(A+B) = \frac{sinAcosB + sinBcosA}{cosAcosB - sinAsinB}$

We can now divide both the top and bottom by cosAcosB to get

$tan(A+B) = \cfrac{\cfrac{sinAcosB + sinBcosA}{cosAcosB}}{\cfrac{cosAcosB - sinAsinB}{cosAcosB}}$
or
$tan(A+B) = \cfrac{\cfrac{sinAcosB}{cosAcosB} + \cfrac{sinBcosA}{cosAcosB}}{\cfrac{cosAcosB}{cosAcosB} - \cfrac{sinAsinB}{cosAcosB}}$

We can now simplify this by cancelling any cosA and cosB to get

$tan(A+B) = \cfrac{\cfrac{sinA}{cosA} + \cfrac{sinB}{cosB}}{1 - \cfrac{sinA sinB}{cosA cosB}}$

finally by substituting the identity $tan(x) = \frac{sinx}{cosx}$ we find our result

$tan(A+B) = \cfrac{ tanA + tanB}{1 - tanAtanB}$

And it can be shown that this result can be extended to

$tan(A \pm B) = \cfrac{tanA \pm tanB}{1 \mp tanAtanB}$

## Maclaurin Series with example sin(x)

The Maclaurin series is a way of approximating a function f(x) using a power series of x. It only works on functions you can differentiate but you can gain any level of accuracy by stopping the series at different points. It is equal to the taylor series for a function about 0. One example of a use of the Maclaurin series is to calculate a value for sin(x).

The Maclaurin series for a function f(x) is as follows:

$f(x) = f(0) + xf'(0) + \frac{x^2 f''(x)}{2!} + \frac{x^3 f'''(x)}{3!} + ...$
or
$f(x) = \sum_{i=0}^{\infty} \frac{x^i f^i (0)}{i!}$

### Example sin(x)

An expression for sin(x) can be calculated using this method. Firstly we must decide what level of accuracy to go to, for the example we will go to the 3rdterm. The next step is to differentiate sinx. Firstly let f(x) = sinx

then

$f(0) = 0$

$f'(x) = cos(x) \quad \quad \quad \Rightarrow \quad \quad \quad f'(0) = 1$

$f''(x) = -sin(x) \quad \quad \quad \Rightarrow \quad \quad \quad f''(0) = 0$

$f'''(x) = -cos(x) \quad \quad \quad \Rightarrow \quad \quad \quad f'''(0) = -1$

$f''''(x) = sin(x) \quad \quad \quad \Rightarrow \quad \quad \quad f''''(0) = 0$

$f'''''(x) = cos(x) \quad \quad \quad \Rightarrow \quad \quad \quad f'''''(0) = 1$

We can now combine these into the series to get

$f(x) = sin(x) = x - \frac{x^3}{3!} + \frac{x^5}{5!} + ...$

$f(x) = sin(x) = x - \frac{x^3}{6} + \frac{x^5}{120} + ...$

which can be used to calculate the value of sin(x)  — though only for the radian measure of angle.

eg)
$sin(\frac{\pi}{3}) = \frac{\pi}{3} - \frac{\pi ^3}{6 \cdot 3^3} + \frac{\pi ^5}{120 \cdot 3^5} + ... \simeq$  0.8663

Which is approximately the value you would get if you type sin(pi/3) into a calculator.

Categories: algebra, calculus, trigonometry

## Complex roots of unity

Without complex numbers taking the square root of any positive integer, such as 1, will give you two answers, in this case +/- 1, but taking the cube roots will only five you one answer, 1. However when we consider the complex roots you will find that the nth root of any number will give you n roots.

This can be shown using De Moivres theorem. Firstly consider the complex number z = cosΘ + isinΘ and let

zn = 1
(cosΘ+isinΘ)n = 1

which using De Moivres theomrm gives

cos nΘ + isin nΘ = 1

We can now compare the real and imaginary parts to find the values of n

cos nΘ = 1 and sin nΘ = 0

Therefore nΘ = 2pπ for integral values of p
So $\theta = \frac{2p\pi}{n}$

which gives

$\theta = \frac{2\pi}{n} , \frac{4\pi}{n} , \frac{6\pi}{n} , \frac{8\pi}{n} , ... , 2\pi$

so the roots of unity are
$z_1 = cos \frac{2\pi}{n} + i sin \frac{2\pi}{n}$
$z_2 = cos \frac{4\pi}{n} + i sin \frac{4\pi}{n}$
$z_3 = cos \frac{6\pi}{n} + i sin \frac{6\pi}{n}$
etc

However what is interesting about these is when you plot them on an argand diagram they are evenly spaced around a circle of radius 1 and centred at the origin. An example for n=8 is shown below

The roots of unity are space evenly around a circle of radius 1 and centre at the origin

This happens becuase the increase in the angle for each successive root is equal since we divided 2pi by n.

## Equations using Polar Co-ordinates

Equations with polar co-ordinates, like those with Cartesian ones, are a relationship between the two co-ordinates. Graphs of these equations can be draw by drawing a line through all the points that satisfy the equation.

Note// This post assumes you can use polar co-ordinates.

Examples of some simple polar equations are

r=θ

Polar graph of r=t for 0<t<pi

and

r=3sinθ

Polar Graph of r=3sint

### Tips for Sketching Polar Graphs

There are number fo ways to make it easier  to sketch polar graphs. Some of the basic methods are as follows:

1. Plot a point for every π/6
2. If the graph is a cos function it will be symmetrical about the initial line (since cos(-x) = cosx). This means you only have to calculate from 0 to π and then draw the other side using symmetry.
3. If the graph is a sin function it will be symmetrical about the line θ=π/2 so you only need to calculate from -π/2 to π/2 and then flip it.

An applet for sketching these graphs is at  http://www.ies.co.jp/math/java/calc/sg_kyok/sg_kyok.html however I recommend that you attempt to sketch the graphs for yourself first and then use it to check. Note that for some graphs it doesn’t seem to give you the sketch for the full range you enter.

### Conversion to and from Cartesian Form

As with points in a 2D plane polar equations can be converted to Cartesian equations and similarly Cartesian equations can be converted to polar ones. To do this we will use the same equations as were need for the conversion of points. These are:

1. x = rcosθ
2. y=rsinθ
3. r2 = x2 + y2
4. θ = tan-1(y/x)

We can then substitute the appropriate equations into the one we want to convert to find its equivlinet.

A Cartesian to polar example

consider the equation of a straight line in Cartesian co-ordinates

y=3+2x

To write this in polar form we can substitute in equations 1 and 2 to get

rsinθ = 3 + 2rcosθ

which can be re-arranged however you like.

A polar to Cartesian example

consider the polar equation

r=3sin θ

Then from 2 we know sinθ=y/r so we get

r = 3y/r

which gives

r2 = 3y
but from 3 we know r2 = x2 + y2
so we get
x2 + y2 = 3y

Categories: algebra, maths

## Using Polar Co-ordinates and Converting to and from Cartesian

Polar co-ordinates are a different co-ordinate scheme to the standard Cartesian co-ordinates.  Again any point in a 2D plane can be located using only two numbers.

It works by taking an “initial line” (shown in red — the equivalent of the positive x axis in Cartesian co-ordinates) with the origin at one end. Then any point can be found by drawing a line from the point to the origin and quoting the length of this line (the radius) and the angle the line makes with the origin. These numbers are usually written in brackets in the same way as Cartesian co-ordinates with the radius first followed by the angle. For example look at the point (3,π/3) below.

The point (3,pi/3) in Polar Co-ordinates

Note// The angles are usually measured in radians

### Cartesian Equivalent of Polar Co-ordinates

Since both Cartesian and polar co-ordinates are a way of describing a point position in a 2D plane it is possible to convert between then. When doing this the initial line is taken as the x-axis.

To find the Cartesian co-ordinates we must use trigonometry by drawing a vertical line down from the point to the x-axis to form a right angled triangle. The length of the vertical line then gives the y- coordinate and its distance from the origin gives the x-coordinate.

To find the x and y values for the point (r,Θ) we must therefore use the equations

x = rcosΘ

and

y = rsinΘ

If we want to go in reverse to find the polar co-ordinates of the point (x,y) in a Cartesian system we must solve these equations simultaneously.

We can eliminate Θ by squaring both of the equations to obtain

x2 = r2cos2Θ
and
y2 = r2sin2Θ

and then adding these equations to get

x2 + y2 = r2(cos2Θ + sin2Θ)

by substituting the trigonometric identity sin2+cos2 = 1 to get

x2 + y2 = r2

we have removed Θ and can therefore calculate r using
r =√(x2 + y2)

To find Θ we can divide the two equations given at the start such that the r’s cancel to get
y/x = sin Θ/cos Θ
which using the identity tan Θ=sin Θ/cos Θ gives

Θ = tan-1(y/x)