Find an equation to the tangent of the curve at the given point. Then graph the curve and the tangent.
$$x=t^2-t,\quad y=t^2+t+1; \quad(0,3)$$
I can do this with a simple $f(X)$ function but the parametric curve part is tricky. Any help?
This is what I get, but I am not sure. But please check if this is what the final solution should be as I am not too good in calculus. There are two solutions, so I picked the one which goes through (0,3)
ClearAll[x, y, t]
eq1 = x == t^2 - t;
eq2 = y == t^2 + t + 1;
r = Eliminate[{eq1, eq2}, t];
sol = y /. Solve[r, y];
slope = (D[Last@sol, x]) /. x -> 0
eq = TraditionalForm@Row[{"y(x)=", slope*x + 3}];
p1 = Plot[Callout[slope*x + 3, eq, Above], {x, -.5, 1}, PlotStyle -> Red];
p2 = Plot[sol, {x, -2, 2}, Frame -> True, GridLines -> Automatic,
GridLinesStyle -> LightGray,BaseStyle -> 14];
Show[p2, p1]
x[t_] = t^2 - t;
y[t_] = t^2 + t + 1;
The value of t
for the point {0, 3}
is
Solve[{x[t] == 0, y[t] == 3}, t][[1]]
(* {t -> 1} *)
The derivative at this point is
y'[t]/x'[t] /. t -> 1
(* 3 *)
Show[
ParametricPlot[{x[t], y[t]},
{t, -1, 2}],
Plot[3 x + 3, {x, -1, 1},
PlotStyle -> Red],
AspectRatio -> 1/GoldenRatio]
Tangent
tan[f_, x_: t, scale_: 0.5] :=
With[{df = D[f, t]},
Arrow[{f, f + scale df / Norm[df]}] /. t -> x]
Normal
nor[f_, x_: t, scale_: 0.5] :=
With[{df = D[f, t]},
Arrow[{f, f + scale (df /. {a_, b_} :> {-b, a}) / Norm[df]}] /. t -> x]
Symbolic example
tan[{t, t^2}, t, 1]
Numeric example:
tan[{t, t^2}, 0.5, 1]
Plotting is straightforward
g := {t, t^2}
Manipulate[
ParametricPlot[g, {t, -1, 1},
BaseStyle -> {PointSize[Large], Thickness[0.005]},
Epilog -> {Orange, tan[g, n], Blue, nor[g, n], Red, Point[g /. t -> n]},
PlotRangePadding -> 0.5],
{n, -1, 1}]
Or use the inbuilt FrenetSerretSystem
tan[f_, x_: t, s_: 0.5] :=
Arrow[{f, f + s FrenetSerretSystem[f, t][[2, 1]]}] /. t -> x
nor[f_, x_: t, s_: 0.5] :=
Arrow[{f, f + s FrenetSerretSystem[f, t][[2, 2]]}] /. t -> x