Reza Malek-Madani

Constructing Tangent Lines to Curves

Recall that if r(t) is the parametrization of a curve C, then r'(t) is tangent to C at the point identified by the parameter value t. This idea is the basis of drawing tangent lines to curves in Mathematica.

Two-dimensional Curves

Let's draw a tangent line to the ellipse r(t)=<2 cos t, 3 sin t> at t = pi/4. First, we plot this curve:

r[t_]={2 Cos[t], 3 Sin[t]};
{t, 0,2Pi},AspectRatio->Automatic]


Next, we construct the tangent line:

rprime[t_]=D[r[t], t];
point = r[Pi/4];
graph2=Graphics[Line[{point, point+rprime[Pi/4]}]];
output1 = Show[graph1, graph2]


Note that we can alter the length of the tangent line by specifying a value different from 1 as the coefficient of rprime in graph2:

graph2=Graphics[Line[{point, point+0.43 rprime[Pi/4]}]];
output1 = Show[graph1, graph2]


Three-dimensional curves

Plotting tangent line in 3-D is very similar to 2-D. Let's consider the curve r(t) = <2 sin t, 3 cos t, t> and plot a tangent vector to it at t= pi/4.

r[t_]={2 Sin[t], 3 Cos[t], t};
rprime[t_] = D[r[t], t];
t0 = 3Pi/4; point = r[t0];
graph1 = ParametricPlot3D[Evaluate[r[t]], {t, 0, 2Pi}, AspectRatio->Automatic];
graph2=Graphics3D[Line[{point, point + 0.97 rprime[t0]}]];
output2 = Show[graph1, graph2]

- Graphics 3D -

go to Top