Trig Functions

Recall the plots of sin x and cos x:

plotsine=Plot[Sin[x],{x,-2Pi,2Pi},PlotStyle->{Orange,Dashed,Thick}]

plotcosine=Plot[Cos[x],{x,-2Pi,2Pi},PlotStyle->{Green,Dashed,Thick}]

plots=Show[plotsine,plotcosine]

The Derivative of y=sin x

The blue curve is y=f(x)=sin x, and the red curve is the derivative (plotting the slope of the tangent line as you move along and vary a).

f[x_]=Sin[x]

plottangent[a_]:=Plot[f'[a](x-a)+f[a],{x,a-0.5,a+0.5},PlotStyle->{Thick,Orange}];

plotf = Plot[{f[x]},{x,-2Pi,2Pi},PlotStyle->{Thick,Blue},PlotRange->{All,All}];

plotderivative[a_] := Plot[{f'[x]},{x,-2Pi-0.1,a},PlotStyle->{Thick,Red}]
plotpoint[a_]:=Show[Graphics[{Red,Disk[{a,f'[a]},{0.2,0.2/Pi}]}]];

Manipulate[Show[plotf,plotderivative[a],plottangent[a],plotpoint[a],PlotRange->{{-2Pi,2Pi},{-2,2}},AspectRatio->1,AxesOrigin->{0,0}],{a,-2Pi,2Pi}]

The Red curve is the derivative, and it sure looks like

f'[x]

The Derivative of y=cos x

Here is the derivative of  cos x

f[x_]=Cos[x]

plottangent[a_]:=Plot[f'[a](x-a)+f[a],{x,a-0.5,a+0.5},PlotStyle->{Thick,Orange}];

plotf = Plot[{f[x]},{x,-2Pi,2Pi},PlotStyle->{Thick,Blue},PlotRange->{All,All}];

plotderivative[a_] := Plot[{f'[x]},{x,-2Pi-0.1,a},PlotStyle->{Thick,Red}]
plotpoint[a_]:=Show[Graphics[{Red,Disk[{a,f'[a]},{0.2,0.2/Pi}]}]];

Manipulate[Show[plotf,plotderivative[a],plottangent[a],plotpoint[a],PlotRange->{{-2Pi,2Pi},{-2,2}},AspectRatio->1,AxesOrigin->{0,0}],{a,-2Pi,2Pi}]

The Red curve is the derivative, and it sure looks like

f'[x]

Notice the minus sign!

Trig function derivatives: Ultimately, you should memorize them all, but for the moment make SURE to memorize the derivatives of sin x and cos x, and then you can always work the rest out using the quotient rule.

D[Sin[x],x]

D[Cos[x],x]

D[Tan[x],x]

D[Sec[x],x]

D[Csc[x],x]

D[Cot[x],x]