# Trigonometric Functions: cos(t) and sin(t)

The trigonometric functions $x=cos(t)$ and $y=sin(t)$ appear as solutions to the initial value problem for $t>0$:

• $\frac{dx}{dt} = -y$         (1)
• $\frac{dy}{dt} = x$           (2)

or in time stepping form

• $x=x-y*dt$
• $y=y+x*dt$

with the following initial values for $t=0$:

• $x=\cos(0)=1$ and $y=\sin(0)=0$.

Watch and play with the code.

Understand that by construction with $D=\frac{d}{dt}$

• $D\cos(t) = -\sin(t)$
• $D\sin(t) = \cos(t)$

Observe that the differential equations express that the velocity vector $(vx,vy)=(\frac{dx}{dt},\frac{dy}{dt})$ and the position vector $(x,y)$ satisfies

• $vx* x + vy*y = -y*x + x*y =0$,        (velocity is orthogonal to position)

which means that the point $(x,y)$ moves around a circle with radius 1, which give $\cos(t)$ and $\sin(t)$ a geometric meaning with t appearing as an angle. Find out the details of the geometry.

Check out this more detailed presentation.

To do:

• Compute Pi (3.14….) by computing the first value of t > 0 such that sin(t)=0 by time stepping (1)-(2).
• Show that  by construction $\sin(s+t) =\sin(s)\cos(t)+\cos(s)\sin(t)$.
• Similarly show other properties of $\sin()$ and $\cos()$
• See that (1)-(2) models a harmonic oscillator of a body connected to a fixed point with a spring modeled by
• $\frac{dv}{dt} =-x$, $v=\frac{dx}{dt}$,

where the acceleration $\frac{dv}{dt}$  is balanced by a spring force scaling with position $x$ measuring the extension of the spring.