Maclaurin series of the sine function

By Martin McBride, 2022-11-17
Tags: maclaurin series sine
Categories: maclaurin series


In this section we will use the Maclaurin series to find a polynomial approximation to the sine function, sin(x).

The general formula for the Maclaurin series for the function f(x) is:

Maclaurin expansion general equation

Where:

  • f(0) is the value of the function for x = 0.
  • f'(0) is the value of the first derivative function for x = 0.
  • f''(0) is the value of the second derivative function for x = 0.
  • f'''(0) is the value of the third derivative function for x = 0.
  • And so on.

To apply this to the sine function, we need to calculate those derivatives.

Derivatives the sine function

In our case f(x) is the sine function:

Sine function

The first derivative of the sine function is the cosine function:

First derivative of sine function

We find the second derivative by differentiating again. If we differentiate the cosine function we get negative sine:

Second derivative of sine function

We find the third derivative by differentiating again. If we differentiate negative sine function we get negative cosine:

Third derivative of sine function

Finally, we find the fourth derivative by differentiating yet again. If we differentiate negative cosine function we get sine:

Fourth derivative of sine function

We are back to the sine function again. If we differentiate again, the pattern will repeat: s, c, -s, -c, s, c, -s, -s ...

Values of the derivatives at x = 0

The sine of 0 is 0, and the cosine of 0 is 1. This allows us to calculate the following values for f(x) and its derivatives when x = 0: This means that:

  • f(0) = 0
  • f'(0) = 1
  • f''(0) = 0
  • f'''(0) = -1

Again, this patten repeats for higher order derivatives: 0, 1, 0, -1, 0, 1, 0, -1 ...

Maclaurin series of sine function

Taking the general equation above:

Maclaurin expansion general equation

We can replace f(0), f'(0), and all of the higher order derivatives with the values we found above:

Maclaurin expansion of sine function

This can be tidied up by removing the zero terms. We have also added some extra terms up to teh term in the 7th power of x:

Maclaurin expansion of sine function

Or using sigma notation (as described here):

Maclaurin expansion of sine function sigma notation

A graphical illustration of the Maclaurin expansion

Here is an animation that shows the first 4 non-zero terms of the expansion being added in one by one:

Maclaurin expansion of exponential function animation

One way to gain an intuitive insight into how the Maclaurin expansion works is to look at graphs of the approximation as we add the terms one by one.

Step 1

Taking just the first term of the expansion gives us:

Maclaurin expansion of sine function 1 term

This graph shows the expansion (in yellow) and the sine function (in black):

Maclaurin expansion of sine function graph 1 term

This approximation is not very good, it is just a diagonal straight line. It has the same value and slope at the sine function at 0, but it diverges away from that point.

Step 2

Taking the first two terms of the expansion gives us:

Maclaurin expansion of sine function 2 terms

Here is the graph:

Maclaurin expansion of sine function graph 2 terms

This is a better approximation, and will continue to improve as we add more terms.

Step 3

Taking the first three terms of the expansion gives us:

Maclaurin expansion of sine function 3 terms

Here is the graph:

Maclaurin expansion of sine function graph 3 terms

Step 4

Taking the first four terms of the expansion gives us:

Maclaurin expansion of sine function 4 terms

Here is the graph:

Maclaurin expansion of sine function graph 4 terms

See also



Join the GraphicMaths Newletter

Sign up using this form to receive an email when new content is added:

Popular tags

adder adjacency matrix alu and gate angle area argand diagram binary maths cartesian equation chain rule chord circle cofactor combinations complex polygon complex power complex root cosh cosine cosine rule cpu cube decagon demorgans law derivative determinant diagonal directrix dodecagon ellipse equilateral triangle eulers formula exponent exponential exterior angle first principles flip-flop focus gabriels horn gradient graph hendecagon heptagon hexagon horizontal hyperbola hyperbolic function infinity integration by substitution interior angle inverse hyperbolic function inverse matrix irregular polygon isosceles trapezium isosceles triangle kite koch curve l system locus maclaurin series major axis matrix matrix algebra minor axis nand gate newton raphson method nonagon nor gate normal not gate octagon or gate parabola parallelogram parametric equation pentagon perimeter permutations polar coordinates polynomial power probability probability distribution product rule pythagoras proof quadrilateral radians radius rectangle regular polygon rhombus root set set-reset flip-flop sine sine rule sinh sloping lines solving equations solving triangles square standard curves star polygon straight line graphs surface of revolution symmetry tangent tanh transformations trapezium triangle turtle graphics vertical volume of revolution xnor gate xor gate