# Finding the Tangent to the Curve [duplicate]

This question already has an answer here:

I could use some help with this. This is my first time using mathematica and im trying to get use to the coding. Find an equation of the tangent to the curve and graph the curve and tangents. x=sin(t) y=t+t^2 Point (0,0)

Where is a good place to start? how would i go about coding this?

Thanks!

## marked as duplicate by Sjoerd C. de Vries, Daniel Lichtblau, RunnyKine, eldo, ÖskåOct 6 '14 at 19:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• Hint: D[f(x), x] computes the derivative of f with respect to x. – Igor Rivin Oct 6 '14 at 17:32
• A good place to start would be to use the word 'tangent' in the search box. At least three questions deal with this. – Sjoerd C. de Vries Oct 6 '14 at 17:34
• @SjoerdC.deVries From JM in his answer there "This is based on the fact that the tangent line is the unique Hermite interpolating polynomial of degree 1." :D – Dr. belisarius Oct 6 '14 at 17:38
• @belisarius I agree, probably not the easiest treatment. How about this one? – Sjoerd C. de Vries Oct 6 '14 at 17:41
• See also this How to make a Line with no end? – Artes Oct 6 '14 at 17:44

## 1 Answer

It is always good to start with a working technology, what you have already learned in Calculus helps you. Embark familiar with the basics of Mathematica and the search functions on this page.

ClearAll["Global*"]


Write down in Mathematica notation what you have:

f[t_] := Sin[t]

g[t_] := t + t^2

p1 = {0, 0};


Make it a plot:

Plot[{f[t], g[t]}, {t, -\[Pi], \[Pi]}
, PlotRange -> {{-\[Pi]/2, \[Pi]/2}, {-1.5, 1.5}}
, Frame -> True
, Epilog -> {Red, PointSize[0.02], Point[p1]}] The tangent line goes through the point P (0, 0), calculate the slope and plot it:

expr = (g[t] - 0)/(t - 0)

m = Limit[expr, t -> 0]

Plot[expr
, {t, -\[Pi]/2, \[Pi]/2}
, PlotStyle -> Darker[Green]
, Frame -> True] The tangent as a function:

tangent[t_] := m (t - 0) + 0


And now all together:

Plot[{f[t]
, g[t]
, tangent[t]}
, {t, -\[Pi], \[Pi]}
, PlotRange -> {{-\[Pi], \[Pi]}, {-1.5, 1.5}}
, Frame -> True
, Epilog -> {Red, PointSize[0.02], Point[p1]}
, PlotLegends -> "Expressions"]
` I hope that gives you a good start - have fun!