Help me plot a tangent with a Sin curve [duplicate]

Hi just wondering how to graph the tangent as well as this curve on the same graph : f(x)= Sin[x] at x=0 where the gradient of the tangent is 1

• Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. – bbgodfrey Feb 13 '15 at 23:09
• Do you mean like Plot[{Sin[x], x}, {x, -\[Pi], \[Pi]}]? Or are you looking for an automated way to construct such plots for arbitrary $f$? – DumpsterDoofus Feb 13 '15 at 23:17
• For an automated way, you could do plotTangent[f_, x0_] := Plot[Evaluate[{f[x], Normal@Series[f[x], {x, x0, 1}]}], {x, x0 - 4, x0 + 4}], and then call plotTangent[f, 0], which produces the desired graph. – DumpsterDoofus Feb 13 '15 at 23:20

Here's some fun:

    Manipulate[
Plot[Evaluate[{f[x], Normal@Series[f[x], {x, x0, 1}]}],
{x, -5, 5},
PlotRange -> {{-5, 5}, {-2, 2}},
Epilog -> {Red, PointSize[0.02], Point[{x0, f[x0]}]}],
{{x0, 0}, -4, 4},
{f, {Sin, Cos, Tan, 1/4 #^2 & -> "x^2/4"}}]


Another approach using derivative.

tangent[f_,x0_]:=(f^\[Prime])[x0] #1+First[b/. NSolve[f[x0]==(f^\[Prime])[x0] x0+b,b]]&;
Manipulate[Plot[Evaluate[{f[x], tangent[f, x0][x]}], {x, -5, 5},
PlotRange -> {{-5, 5}, {-2, 2}},
Epilog -> {Red, PointSize[0.02], Point[{x0, f[x0]}]}], {x0, -5,
5}, {f, {Sin, Cos,(.2 #^2 - 1.5) &}}]

• tangent appears to be undefined. – bbgodfrey Feb 14 '15 at 0:45