# Trigonometric Functions

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

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

or in time stepping code form

• $x=x-y*dt$   (as $dx = -y*dt$)
• $y=y+x*dt$  (as $dy = 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)$.

Conclude that both $cos(t)$ and $sin (t)$ solves the second-order differential equation (initial value problem) in a function $u(t)$

• $D^2u + u \equiv \frac{du^2}{dt^2}+u=0$ for $t > 0$,

with the following initial values:

• $u(t)=cos(t): \quad u(0)=1,\quad Du(0)=0$,
• $u(t)=sin(t): \quad u(0)=0,\quad Du(0)=1$,

Observe that the differential equations (1)-(2) 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)$. Hint: Note that $u(t)=sin(s+t)$ solves $D^2u + u = 0$ with initial conditions $u(0)=sin(s)$ and $Du(0)=cos(s)$ and so is the linear combination $sin(s)cost(t)+cos(s)sin(t)$.
• Similarly show other properties of $\sin(t)$ and $\cos(t)$.
• See that (1)-(2) models a harmonic oscillator of a body connected to a fixed point with a spring modeled by dx = – v*dt and dv = x*dt, where the acceleration dv/dt  is balanced by a spring force scaling with position x measuring the extension of the spring.