Differentiation of Sin x

Move the point P with your mouse. If we were to plot a graph using the slope of the tangent at the various points P we would end up with a cosine curve as shown below.

1

1

0

-1

-2\pi

-\pi

\pi

2\pi

3\pi

4\pi

5\pi

P

Q

m = 0.6169809378411518
f(x) = sin(x)
C_1 = Point(f)
h(x) = cos(x) - 3
A = (0, 1)
B = (0, 0)
C = (0, -1)
D = (0, -2)
E = (0, -3)
F = (0, -4)
G = (0, -5)
H = (0, -6)
I = (0, -7)
a = Line(E, xAxis)
J = (-6.28, -3)
K = (-3.14, -3)
L = (3.14, -3)
M = (6.28, -3)
N = (9.42, -3)
O = (12.56, -3)
P = (15.7, -3)
Q = (18.84, -3)
R = (21.98, -3)
S = (-6.28, -6)
T = (-3.14, -6)
U = (3.14, -6)
V = (6.28, -6)
W = (9.42, -6)
Y = (12.56, -6)
Z = (15.7, -6)
A_1 = (18.84, -6)
B_1 = (21.98, -6)
t = Tangent(C_1, f)
D_1 = Point(Circle[C_1, 3])
c = Segment(C_1, D_1)
d = Circle(C_1, D_1)
E_1, F_1 = Intersect(d, t)
e = Segment(F_1, E_1)
i = OrthogonalLine(C_1, xAxis)
G_1 = Intersect(h, i, (0.4263038548752834, -2.0894996477550096))
T27: "y = \sin x = " + (f(x(C_1)))
T28: "\frac{dy}{dx} = \cos x = " + (cos(x(C_1)))
b = Slope(e)
T2: Q + ""
T7: "Slope \, of \, the \, tangent \, at\, P\, is \, " + b
T8: "Coordinates \, of \, Q \, are \,   (" + (x(C_1)) + "," + b + ")"
T16: "m = " + b
A1 = Point(e)
T17: "cos x = " + b