(*Video 1: Derivatives*)

D[x^3,x]

D[x^n,x]

D[x^4+2x^2-1,x]

f[x_]:=1/2x^6-8x^3+1

f[x]

f'[x]

f'[5]

D[1/2x^6-8x^3+1,x]

-24 (x^2)+3 (x^5)/.x->5

graphf=Plot[f[x],{x,-1.5,3}];
graphfprime=Plot[f'[x],{x,-1.5,3},PlotStyle->Orange];
Show[graphf,graphfprime]

Clear[f,graphf,graphfprime]

f[x_]:=x^2+1

f'[x]

graphf=Plot[f[x],{x,-1.5,3}];
graphfprime=Plot[f'[x],{x,-1.5,3},PlotStyle->Orange];
Show[graphf,graphfprime]

(*Video 2: Tangent lines*)
f[x_]:=x^2+1

f'[x0]

f[x0]

(*The equation of the tangent line to the graph of f[x] at the point (x0,f[x0]) is:*)
y[x]=f'[x0](x-x0)+f[x0]

f'[x0]

x0=3;
Simplify[f'[x0](x-x0)+f[x0]]
Plot[{f[x],f'[x0](x-x0)+f[x0]},{x,-2,4},PlotRange->{-10,10}]

Clear[x0]

Manipulate[Grid[{{Row[{"Tangent line has slope = ",f'[x0]," and y-intercept =",f[x0]-x0 f'[x0]}]},{Plot[{f[x],f'[x0](x-x0)+f[x0]},{x,-2,4},PlotRange->{-3,10},ImageSize->500]}},Spacings->{1,1},Frame->All],{{x0,1},-2,4}]

Clear[f]

f[x_]:=x^3-4x^2+x+2
y[x]=f'[x0](x-x0)+f[x0]

Manipulate[Grid[{{Row[{"Tangent line at ",x0," has slope = ",f'[x0]," and y-intercept =",f[x0]-x0 f'[x0]}]},{Plot[{f[x],f'[x0](x-x0)+f[x0]},{x,-2,4},PlotRange->{-6,10},ImageSize->600]}},Spacings->{1,1},Frame->All],{{x0,1},-2,4}]