This material was developed by Aaron Tresham at the University of Hawaii at Hilo and is

licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

- Intro to Sage
- Graphing and Solving Equations
- Tangent Lines

Suppose $x$ and $y$ are both functions of a variable $t$, called the "parameter." Then each value of $t$ gives a point in the x-y plane, $(x(t),y(t))$. The set of all such points as $t$ varies is called a "parametric curve," and the equations defining this curve are called "parametric equations."

Below is an example of a parametric curve. Notice that $y$ is not a function of $x$ (or vice versa). Graphs of functions form a really limited collection of curves, and parametric curves provide many more kinds of graphs.

Below is an animation which shows the above curve being drawn as $t$ starts at $0$ and increases to $\pi$.

You can graph a parametric curve by hand using a table of values - just choose some values of $t$ and plug them into the $x$ and $y$ functions. This is usually pretty tedious.

Sage can handle parametric curves using the parametric_plot command, as in the example above.

First, declare the variable $t$. Then define $x(t)$ and $y(t)$. Finally, type parametric_plot((x(t),y(t)),(t,0,pi)). Notice that (t,0,pi) controls which values of $t$ are used. You may want to increase pi if the graph looks incomplete.

There is a toy called the Spirograph that lets you draw interesting curves using a collection of wheels. We can produce these pictures using Sage.

In the interact below, experiment with different values of $a$ and $b$. If the curve looks incomplete, then increase tmax.

For example, try $a=21,\ a=\frac{1}{2},\ a=\sqrt{2}$ (increase tmax to 100*pi for this one).

Interact: please open in CoCalc

We would like to do calculus with parametric curves, such as finding the slope of the curve.

Consider the parametric curve below, which has equations $x(t)=2\sin(2t)$ and $y(t)=2\sin(t)$.

Although $y$ is not a function of $x$, it looks like the curve should have tangent lines. How do we find the slope of the tangent line?

By the Chain Rule: $\displaystyle\frac{dy}{dt}=\frac{dy}{dx}\cdot\frac{dx}{dt}$.

If $\displaystyle\frac{dx}{dt}\ne 0$, then we can solve for $\displaystyle\frac{dy}{dx}$ to get $\frac{dy}{dx}=\frac{\frac{dy}{dt}}{\frac{dx}{dt}}$

In other words, the slope of the curve in the x-y plane is given by $\displaystyle\frac{y\,'(t)}{x'(t)}$.

Notice that this slope is given as a function of $t$. So if we want the slope of the curve at a particular point $(x,y)$, then we need to find a value of $t$ that gives us this point.

Find an equation for the tangent line to the curve above at $t=\frac{\pi}{6}$.

First, find the slope function. I'll call this function $m$.

$\displaystyle \frac{\cos\left(t\right)}{2 \, \cos\left(2 \, t\right)}$

Now let's find the slope when $t=\frac{\pi}{6}$.

$\displaystyle \frac{1}{2} \, \sqrt{3}$

Next, we calculate $x\left(\frac{\pi}{6}\right)$ and $y\left(\frac{\pi}{6}\right)$, then we use the point-slope form of a line: $y=y_1+m(x-x_1)$

sqrt(3)
1

Notice that the tangent line is a function of $x$, not $t$. In order to not interfere with our parametric function $x(t)$, I will use capital $X$ for the tangent line.

$\displaystyle \frac{1}{2} \, \sqrt{3} {\left(X - \sqrt{3}\right)} + 1$

What happens to the derivative when the curve crosses itself?

In the curve above, the curve intersects itself at $(0,0)$.

What values of $t$ result in $(x(t),y(t))=(0,0)$?

We need a value of $t$ that gives both $x(t)=0$ and $y(t)=0$.

First, we'll ask Sage to solve the equations.

[t == 0]
[t == 0]

Sage tells us that $t=0$ will work. Is that the only possiblity?

No, we know there are more solutions, since $x$ and $y$ are both periodic functions. We can get Sage to give us a more complete answer by adding the optional argument to_poly_solve='force' (don't worry about what this does).

[t == 1/2*pi*z45]
[t == pi*z50]

In the output above, the variables z45 and z50 are assumed to be any integer (that's what the "z" is for).

In other words, $x(t)=0$ when $t=\frac{z\pi}{2}$ for any integer $z$, i.e., $t=0,\ \pm\frac{\pi}{2},\ \pm\frac{2\pi}{2}=\pm\pi,\ \pm\frac{3\pi}{2},\ \pm\frac{4\pi}{2}=\pm 2\pi,$ etc.

On the other hand, $y(t)=0$ when $t=z\pi$ for any integer $z$, i.e. $t=0,\ \pm\pi,\ \pm 2\pi,\ \pm3\pi,$ etc.

The values of $t$ on both of these lists result in both $x$ and $y$ being $0$.

Look at the two lists, and see what they have in common. In this case, both lists have $t=z\pi$.

What is the slope of the curve when $t=z\pi$? Let's try a few values of $z$.

1/2
-1/2
1/2
-1/2
1/2

We get two different slopes: $\frac{1}{2}$ and $-\frac{1}{2}$.

Since there are two different slopes, there must be two different tangent lines.