\begin{refsection}
\chapter{Formation of Rainbow}

\section*{Objectives}

\begin{enumerate}
\item To study different orders of rainbows formed by a drop of water.
\item To study specifically the second-order rainbows for liquids of different refractive indices.
\item To determine the refractive index of an unknown liquid using the second-order rainbow it forms.
\end{enumerate}

\section*{Introduction}
The rainbow is probably one of the most spectacular light shows observed naturally in the sky. The conventional explanation to the formation of a rainbow is that sunlight -- which is composed of a spectrum of colours -- is separated into its constituent colours by the large number of water droplets present in the air on a rainy day, very much like the dispersion of light by a prism.

However, as we shall see, this is not the full story. To completely understand the formation of the rainbow and its location in the sky, we need to take into account the fact that the droplets are actually spherical, and that the incident light may be reflected many times within the drop before exiting it.

In the case of a primary (or first order) rainbow, the sunlight incident on a raindrop is refracted at the front surface, reflected at the back surface and refracted again as it emerges into the air.

However, it is possible for sunlight to be reflected internally twice, before exiting the drop. While the intensities of such light rays will be much weaker than those that have been reflected only once, it is possible to see such `secondary' (or higher-order) rainbows in nature. Secondary rainbows -- as we shall see -- are formed at angles that are further out from their primary counterparts. Thus, we speak of the ``order'' of a rainbow as the number of times light has been reflected within the drop.\footnote{\textbf{Note:} While the light \textit{is} reflected inside the drop, it is \textit{not} due to total internal reflection. The angles that the rays of light make with the normal inside the drop are less than the critical angle for the water-air interface.} Higher-order rainbows are almost never seen naturally, as they are weaker than the background brightness of the sky and are usually positioned inconveniently with respect to the sun; if you are lucky, you can sometimes see a second-order rainbow.

An instructive way to understand the formation of rainbows is to actually study the dispersion of white light by a spherical drop of water, as we shall in the present problem. (Note, however, that we use the word ``rainbow'' very loosely, to mean a ``rainbow-like \textit{spectrum}'' rather than the more familiar ``rainbow'' in the sky.)

\section*{Theory}

We will be dealing with the propagation of light between different transparent materials. When light moves from one medium to another, it changes direction through a process known as \textit{refraction}. Thus, at least for the purposes of this experiment, we can characterise different transparent media by their refractive indices: a dimensionless number ($\mu$) which describes how much light bends when it enters the medium from vacuum.

\begin{figure}[!htb]
\captionsetup[subfigure]{justification=centering}
\centering
        \begin{subfigure}[b]{0.5\textwidth}
        \centering
                \includegraphics[scale=0.5]{figs/snell1.png}
                \caption{$\mu_1<\mu_2:$\\ The refracted ray is deviated towards normal.}
                \label{fig:rareToDense}
        \end{subfigure}\hfill
        \begin{subfigure}[b]{0.5\textwidth}
        \centering
                \includegraphics[scale=0.5]{figs/snell2.png}
                \caption{$\mu_1>\mu_2:$\\ The refracted ray is deviated away from normal.}
                \label{fig:denseToRare}
        \end{subfigure}
        \par\bigskip
        % \begin{subfigure}[b]{\textwidth}
        % \centering
        %         \includegraphics[scale=0.5]{figs/snell3.png}
        %         \caption{$\mu_1>\mu_2:$\\ Beyond some $\theta_c$, the refracted ray is reflected internally.}
        %         \label{fig:til}
        % \end{subfigure}
        \caption{The propagation of a ray of light between media of different refractive indices.}\label{fig:snells}
\end{figure}

The relationships between the angles $\theta_1$ and $\theta_2$ (shown in Figure (\ref{fig:snells})) is given by the Sahl-Snell–Descartes law (usually called Snell's law):

 \begin{equation}
    \mu_1 \sin{\theta_1}= \mu_2 \sin{\theta_2}.
    \label{snell}
 \end{equation}

As light passes from a rarer to a denser medium (as shown in Figure (\ref{fig:rareToDense})), the ray of light bends \textit{towards} the normal, while as light travels from a denser to a rarer medium (Figure (\ref{fig:denseToRare})), the ray of light bends \textit{away} from the normal.
%When light moves from a denser to a rarer medium ($\mu_1>\mu_2>1$), there must be \textit{some} angle (let's call it $\theta_c$) greater than which the resulting refracted ray bends back inwards (Figure (\ref{fig:til})). This phenomenon, called \textbf{Total Internal Reflection}, plays a crucial role in the formation of the rainbow.

\subsection*{The Primary Rainbow}

Consider Figure (\ref{fig:firstOrder}) for first order $(K = 1)$ rainbow formed by a spherical drop of liquid with refractive index $\mu$.

\begin{figure}[!htb]
    \centering
    \includegraphics[width=0.5\textwidth]{figs/rainbow1.png}
    \caption{Ray diagram for the formation of a first order rainbow, with angles marked.}
    \label{fig:firstOrder}
\end{figure}

Let $RABCS$ be the path of a ray of incident monochromatic light, which comes out of a spherical droplet of liquid after suffering two refractions at $A$ and $C$ and one reflection at $B$.

Let $i$ be the angle of incidence and $r$ be the angle of refraction at $A$. It should be clear to you that $r$ is also the angle of incidence and reflection at $B$.\footnote{The triangle $ABO$ is an isosceles triangle.} At the point $C$, since the angle of incidence inside the droplet is $r$, the angle of emergence (at $C$) will be $i$.

\begin{question}
\paragraph{Question:} Show that at the point $C$, the angle of incidence is $r$ and, using Equation (\ref{snell}), that the angle of emergence is indeed $i$.
\end{question}

We can now calculate the total \textit{deviation} of the ray as it passes through the drop. From Figure (\ref{fig:firstOrder}) it should be clear that at the point $A$, if not for the drop the ray would have travelled along the dotted line. Thus, the deviation is $(i-r)$. Similarly, upon reflection at $B$, the ray deviates by $(180-2r)$. And finally, at $C$, the ray again deviates by $(i-r)$. Thus, the total deviation is:

\begin{equation}
\phi_{1}=2(i-r)+(180-2r).
\end{equation}

If we now consider the second-order rainbow as shown in Figure (\ref{fig:secondOrder}). The difference between this case and the previous one is that there are now two reflections within the drop. The deviations due to each of the reflections will be the same, and thus the total deviation due to both the reflections is $2\times (180 - 2r)$.

\begin{figure}[!htb]
    \centering
    \includegraphics[width=0.5\textwidth]{figs/rainbow2.png}
    \caption{Ray diagram for the formation of a second-order rainbow, with angles marked.}
    \label{fig:secondOrder}
\end{figure}

We can now generalise this: for a $K^\text{th}$ order rainbow (corresponding to $K$ internal reflections), the deviation is $K\times(180 - 2r)$. As there are only two refractions (one at the point of incidence, and one at the point of emergence), the total deviation $\phi_K$ suffered by the emergent ray after $K$ internal reflections will be

\begin{equation*}
    \phi_K = 2(i-r) + K(180-2r),
\end{equation*}

or more simply,

\begin{equation}
    \phi_K = 180K + 2i - 2r(K+1)
    \label{mindevK}
\end{equation}

\subsubsection*{The angle of minimum deviation}

Let us go back to look at the first order rainbow. We have:

\begin{equation*}
    \phi_1 = 180 + 2 i - 4 r
\end{equation*}

\begin{question}
\paragraph{Question:} Show that the angle $\varphi$ between the initial and and final ray is given by
\begin{equation}
    \varphi = 4 r - 2 i
\end{equation}
\end{question}

Using Equation (\ref{snell}), we can express $r$ in terms of $i$ and $\mu$. For a drop of refractive index $\mu$, we can rewrite it as:\footnote{The refractive index of air can be taken to be $1$.}

\begin{equation}
    \mu = \frac{\sin{i}}{\sin{r}}
    \label{snellir}
\end{equation}

 or equivalently,

 \begin{equation}
     r = \sin^{-1}\left(\frac{\sin{i}}{\mu}\right).
     \label{rasfnofu}
 \end{equation}

The calculation of $\varphi$ shows that it increases from zero at $i=0$, to a maximum value of $42^\circ$, and then drops to about $14^\circ$ at $i=90^\circ$. Consequently, the angle $\phi_1$ \textit{decreases} from $180^\circ$ to a minimum value of $137.6^\circ$ (as can be seen in Figure (\ref{fig:minDevGraph})). At this angle, the emergent ray is deviated the \textit{least} from the direction of the incoming sunlight.

\begin{figure}[!htb]
    \centering
    \includegraphics[scale=0.5]{figs/minimumDevGraph.png}
    \caption{The angle of deviation approaches a minimum value of around $138^\circ$ at $i=59.4^\circ$ ($r=40.2^\circ$ and $\varphi_1^\text{max} = 42^\circ$). The significance of this minimum is that rays from a range $I_1$ around the minimum ``bunch'' closer together than those from a range $I_2$ centred around some other point.}
    \label{fig:minDevGraph}
\end{figure}

However, for us to actually \textit{see} the rainbow, the different rays would nee to be ``bunched'' together, producing a higher concentration of rays that can be detected by our eyes. This is the significance of the angle of deviation being minimum: as shown in Figure (\ref{fig:minDevGraph}), consider an interval $I_1$ centred on the minimum and an interval $I_2$ of the same width centred elsewhere. The range of deviation angles for values in $I_1$ (given by the interval $D_1$) is much smaller than the range of deviation angles for values in $I_2$ (given by the interval $D_2$). Thus, rays that hit the droplet with angles $i$ in $I_1$ stick closer together than rays in $I_2$.

The reason that the rainbow appears coloured is that water has a slightly different index of refraction at different wavelengths causing this angle of minimum deviation -- known as the ``rainbow'' angle -- to vary with wavelength. In water droplets the angle of minimum deviation is $137.6^\circ$ for red light and $139.4^\circ$ for blue light. The arc of the rainbow comes from the fact that in order to see a rainbow, we must look at any direction which is at an angle of roughly $138^\circ$ from the sun's direction,\footnote{Or $42^\circ$ from the antisolar point.}, and this condition describes a circle as shown in Figure (\ref{fig:rainbowSky}). Thus, the rainbow is formed at a particular angle in the sky, and this angle is a function of the refractive index of the droplet.

\begin{figure}[!htb]
    \centering
    \includegraphics[width=0.5\textwidth]{figs/img1.jpg}
    \caption{Ray diagram showing the dispersion of light within the droplet. The rainbow is thus seen roughly between $40^\circ$ and $42^\circ$ from the anti-solar point.}
    \label{fig:dispersionInDrop}
\end{figure}

\begin{figure}[!htb ]
    \centering
    \includegraphics[scale=0.75]{figs/rainbowAtBeach.png}
    \caption{The rainbow in freshwater raindrops is extended below the horizon by a rainbow in seawater spray. The refractive index of saltwater drops causes the radius of the sub-horizon rainbow to be $0.8^\circ$ less than that of the above-horizon freshwater rainbow. Solar elevation is $32.5^\circ$. \texttt{Photograph taken by J. Dijkema in the Pacific Ocean, 800 km southeast of Japan, during 1981. © G.P. Können. Source:~\cite{konnen_rainbows_2017}}}
    \label{fig:rainbowAtBeach}
\end{figure}

% The rays that make up the rainbow were reflected at least once inside the drop, but not all the reflected rays contribute; the rest emerge at different angles and are not visible to the observer. The main reason higher-order rainbows are not visible in the sky is the glare of sunlight directly transmitted or reflected from raindrops. In our experiment too this `glare' tends to obscure the rainbows, but it is more easily controlled. Since only the light falling on a part of the drop contributes to a given rainbow, and the bright glare spots often result from light striking another part, it is therefore possible reduce the glare by masking a part of the incident beam.

% Let us thus imagine that only half the drop is illuminated (as will be done in this experiment): all the parallel rays are refracted when they enter the drop, and then reflected by the interior surface before being refracted as they leave. It should be clear (as can be seen in Figure (\ref{fig:rainbowDeviation})) that the emerging light is scattered over a large range of angles, depending on where the deviating ray makes contact with the drop's surface. At a certain position in the drop, a \textbf{minimum deviation point} is reached. Rays that strike the drop around this point are `bunched' together, and their brightness is further enhanced. It is precisely this phenomenon that makes the rainbow more visible in the sky than other scattered light.

\begin{figure}[!htb]
    \centering
    \includegraphics[width=0.75\textwidth]{figs/rainbowDeviation.jpeg}
    \caption{Ray paths forming a primary rainbow (\textit{left}) and a secondary rainbow (\textit{right}): The rays $f$ and $g$ in the primary rainbow and $g$ and $h$ in the secondary rainbow are `bunched' together as they are close to the angle of minimum deviation. \texttt{Source:~\cite{walker_multiple_1976}}}
    \label{fig:rainbowDeviation}
\end{figure}

We will thus observe the rainbow at the minimum value of $\phi_K$ from the sun,\footnote{Or $\varphi_K = 180 - \phi_K$ from the anti-solar point: in other words, the $K^\text{th}$ rainbow will appear at an angle $\varphi_K$ from the line joining the tip of your head to the tip of your shadow's head.} which we can find by enforcing the condition\footnote{That this condition represents the case of minimum deviation is clear from the fact that if $\frac{\dd^2 \phi_K}{\dd i^2}$ is calculated, it is found to be positive.}  $$\frac{\dd\phi_K}{\dd i}=0.$$

% \begin{imp}
% The index of refraction -- which determines how much the rays are being bent on entering or leaving the drop -- is different for each colour,\footnote{You will understand why this is the case in a later course on optics.} and as a result, each colour has a different angle of minimum deviation, where the scattered light is most intense. The first-order rainbow can thus be found between 137.6 degrees (for red) and 139.4 degrees (for blue).
% \end{imp}

\begin{figure}[!htb]
    \centering
    \includegraphics[width=0.5\textwidth]{figs/rainarc.png}
    \caption{Angular position of the primary rainbow in the sky.}
    \label{fig:rainbowSky}
\end{figure}

\begin{question}
\paragraph{Question:} Suppose for a moment that the refractive index of materials \textbf{didn't} depend on the wavelength of light. In this case, rainbows would:
\begin{enumerate}
\itemsep0em
    \item Remain unchanged.
    \item Not be formed.
    \item Simply be a bright white band of light.
\end{enumerate}

\paragraph{Question:} In Figure (\ref{fig:rainbowAtBeach}), is the refractive index of salt water more than or less than that of the raindrops?
\end{question}

Differentiating Equation (\ref{mindevK}), we have

\begin{equation*}
\begin{aligned}
\frac{\dd\phi_{K}}{\dd i}&=2-2\frac{\dd r}{\dd i}-2K\frac{\dd r}{\dd i}\\
&=2-2(K+1)\frac{\dd r}{\dd i}\\
\frac{\dd \phi_{K}}{\dd i}&=0\Rightarrow2-2(K+1)\frac{\dd r}{\dd i}=0
\end{aligned}
\end{equation*}

Hence,
\begin{equation}
    \frac{\dd r}{\dd i}=\frac{1}{K+1}
    \label{mindevcond}
\end{equation}

Thus, for a $K^\text{th}$ order rainbow at the angle of minimum deviation, Equation (\ref{mindevcond}) relates the angle of refraction to the angle of incidence.

We can use  Equations (\ref{rasfnofu}) and (\ref{mindevK}) to relate the total deviation $\phi_K$ for the $K^\text{th}$ order rainbow to the angle of incidence $i$ and the refractive index $\mu$:

 \begin{equation}
     \phi_K = 180K + 2i - 2(K+1)\sin^{-1}\left(\frac{\sin i}{\mu}\right)
     \label{phiKi}
 \end{equation}

In particular, for $K = 2$, one can show -- using Equations (\ref{phiKi}) and (\ref{iK}) -- that

\begin{equation}
   \cos\left( \frac{\phi_2}{6}\right) = \frac{1}{\mu}\left( 3 \cos\left(\frac{i + 180}{3}\right) \cos{i} + \sin\left(\frac{i + 180}{3}\right)\sin{i} \right)
\end{equation}

We could also derive a relation between the angle of incidence and the refractive index for different orders of rainbows. Differentiating Equation (\ref{snellir}) with respect to $i$, we obtain,
 \begin{equation*}
     \cos i = \mu\cos r \frac{\dd r}{\dd i}
\end{equation*}

Substituting the expression for $\frac{\dd r}{\dd i}$ from Equation (\ref{mindevcond}) in the above equation, and using the Snell's law relation and the trigonometric identity, $\sin^2 x + \cos^2 x = 1$, we have
\begin{equation}
\cos i=\frac{\sqrt{\mu^{2}-\sin^{2}i}}{K+1}
\end{equation}
Squaring both sides, and using the same trigonometric identity again, the equation $(K^2 + 2K)\cos^2 i = (\mu^2 - 1)$ is obtained.
Hence, we have
\begin{equation}
    \cos i = \sqrt{\frac{\mu^2 - 1}{K(K+2)}}.
    \label{iK}
\end{equation}

\begin{figure}[!htb]
    \centering
    \begin{subfigure}[b]{0.5\linewidth}
    \centering
    \includegraphics[width=\textwidth]{figs/multipleRainbows.jpeg}
    \end{subfigure}%
    \begin{subfigure}[b]{0.5\linewidth}
    \centering
    \includegraphics[width=0.75\textwidth]{figs/multipleRainbowsLab.jpeg}
    \end{subfigure}
    \caption{Rainbows represented as they would appear in the sky (\textit{left}) and in this experiment (\textit{right}), relative to the incident beam of light. \texttt{Source:~\cite{walker_multiple_1976}}}
    \label{fig:rainbow}
\end{figure}

\section*{Experimental Setup}

\subsection*{Apparatus}

\begin{enumerate}
\item A modified spectrometer
\item An incandescent lamp
\item A power supply for the lamp
\item A holder for the syringe
\item Four small syringes
\item Four small beakers
\item Four small Petri dishes
\item A magnifying reading torch
\item Water, glycerine, clove oil, and an unknown liquid A (5 ml each)
\item A spirit level
\item Light blocking screen
\end{enumerate}

\subsection*{Description}

\begin{description}
    \item[The (modified) spectrometer]

    A spectrometer is an optical instrument, which may be used to study the spectrum of light, and can in particular be used to measure angles. It consists of four parts: a collimator, a telescope, a prism table and a circular scale disc.

    The \textbf{collimator} is used to obtain a parallel beam of light. The collimator is a tube with a lens at the back (called the collimator lens) and an adjustable slit at the front. The distance between the slit and the collimator lens can be adjusted with the help of a knob fixed to its body. The \textbf{telescope} is used to collect and observe parallel light. The telescope is another tube with an arrangement of lenses (called the objective and the eyepiece) at the ends. The distance between the objective and the eyepiece may also be adjusted. The \textbf{prism table} is a circular table with levelling screws, which is mounted at the centre of the circular scale disc. The prism table is used to mount optical components (prisms, obviously, but also gratings, etc.).  The \textbf{circular scale disc} is used to measure and record the position of the telescope arm and thus measures the angle of displacement. The circular scale disc has three scales, a circular main scale and two identical vernier scales. The vernier scales are fixed along two windows to the prism table and the circular main scale moves with telescope arm.

    \textbf{Modifications:} In the modified spectrometer, the mounting base of the collimator arm has been extended to move the collimator away from the circular base and hence increase the range of movement of the telescope. The collimator is provided with an extra adjustable slit mounted externally on its back. This extra slit allows us to block the light falling on one side of the liquid drop so that only one half of the liquid drop is illuminated. The telescope does not have the regular lens arrangement, but instead the eyepiece is replaced by a pinhole and the objective is replaced by a lens of suitable focal length. This is done to obtain a magnified image of the drop. The circular scale disc is kept as it is.

    A specially designed holder is fixed on the prism table, within which a syringe may be clamped. The holder is designed so that when the syringe is clamped properly and the drop is obtained, the drop is seen from all the angular positions of the telescope exactly at the centre of field of view.

    \begin{figure}[!htb]
        \centering
        \includegraphics[width=0.70\textwidth]{figs/img2.jpg}
        \caption{Schematic of the experimental setup}
        \label{fig:experimentalsetup}
    \end{figure}

    \item[Halogen lamp]

    A high power (150 W, 24 V) tungsten filament halogen lamp (such as those commonly used in projectors) is provided as a source of white light. This lamp has a small filament, through which a high current (6 A) can be passed. It is mounted in a wooden box, on a stand whose height may be adjusted. The wooden box has four windows through which the light may be observed. A small fan is fixed inside the box to prevent excessive heating. The lamp has a specially designed 24 V (AC) power supply which powers it. The intensity of light emitted by the lamp may be changed on the supply. This is essential for observing the higher-order rainbows, as one may need to have white light of higher intensity.

    \item[Miscellaneous]
    A set of four small syringes, beakers, and Petri dishes are provided. Beakers may be used to store different liquids. Petri dishes can be placed on the prism table and are used to collect the liquid that falls from the syringe. Four different liquids (water, glycerine, clove oil, and an unknown liquid A) are also supplied. A magnifying reading torch is provided to read the circular scale, and a light blocking screen may be used to block the stray light falling on the drop. A spirit level may be used for levelling the prism table.

\end{description}

\subsection*{Useful Data}
\begin{itemize}
    \item Refractive index of water = 1.33
    \item Refractive index of glycerine = 1.47
    \item Refractive index of clove oil = 1.53
\end{itemize}

\subsection*{Precautions}
\begin{itemize}
\item Avoid observing the source directly through the telescope for long time.
\item Clamp the syringe on its holder carefully, so that it is held properly.
\item Use different Petri dishes, beakers, and syringes, for different liquids to avoid mixing.
\item Light reflected directly from the external surface of the drop will produce bright white glare spots that will hinder your observations. You will have to account for this and identify the rainbows carefully.
\item The measurements have to be performed in a dark room.
\item Use only one window of the spectrometer for recording the readings. Use the same one throughout your experiment.
\end{itemize}

\section*{Experimental Problem}
\subsection*{Part A}

In this part, you will study the formation of rainbows of different orders by a suspended drop of water and measure their angular positions. You can observe these rainbows directly with your eye and can measure their angular positions using a telescope and a circular scale.

\begin{imp}
Begin by determining the least count of the spectrometer.
\end{imp}

\begin{enumerate}
    \item Level the prism table using a spirit level.

    \item Fill the syringe with water and mount it on the holder clamped to the prism table.

    \item Keep the Petri dish on the prism table to collect the water drops, which may fall down from the nozzle of the syringe.

    \item Obtain a steady drop of water at the nozzle of the syringe.

    \item Adjust the height of the syringe such that the drop is seen at the centre of the field of view of the telescope.

    \begin{question}
    \paragraph{Question:} The rays of light falling on the drop \textbf{must} be parallel. How would you make sure this is the case?
    \end{question}

    \item Adjust the alignment of the source, the collimator, the suspended drop, and the telescope, such that the drop is fully illuminated by the parallel beam of light. Close the back slit of the collimator partially, so that only the vertical half of the drop is illuminated by white light.

    \begin{question}
    \paragraph{Question:} If the rays of light falling on the drop are parallel, does this mean that all the rays striking the drop will be refracted by the same angle? Explain your answer.
    \end{question}

    \item Keep the telescope, collimator, and the drop in the straight line; you will see white light coming from the central region of the drop. Note the angular position of the telescope at which this happens and treat it as the ``direct'' -- or undeviated --  reading for further measurements. As stated earlier, this drop will produce rainbows of different orders, which can be observed at different angular positions around the drop. Thus the angular positions of different order rainbows (for water) will be as shown earlier in Figure (\ref{fig:firstOrder}).

    \item Observe the bright first-order rainbow to the right of the drop $(K = 1)$ first by eye and then by telescope. Adjust the telescope such that the bright red line of the spectrum can be seen. Measure the total angle of deviation $\phi_1$.

    \item Repeat the above step for the second-order rainbow $(K = 2)$ and then for orders up to at least the fifth $(K = 5)$. (In this case you may change the intensity of lamp.) Measure the total angle of deviation $\phi_K$ for each order. (Note: Before taking readings for each order, adjust the telescope to see the red line of the spectrum.)

    \item Plot a graph of $\phi_K$ against $K$ for the different order rainbows $(K = 1, 2, 3, \hdots)$ formed due to a water drop.
\end{enumerate}

\subsection*{Part B}

In this part, you will obtain the rainbows with different liquids and relate the deviation for the second-order rainbow with the refractive index of the liquids.

\begin{enumerate}
    \item Replace the syringe and Petri dish containing water by the syringe and Petri dish containing glycerine and adjust the syringe to see the glycerine drop from all the positions of the telescope.

    \item Measure $\phi_2$ for glycerine, following the same procedure as in \textbf{Part A}.

    \item Repeat the above steps, for the clove oil and the given unknown liquid $A$. Determine $\phi_2$ for clove oil and the liquid $A$.

    \item Plot a graph of $\cos(\phi_2 / 6)$ against $1/\mu$ for water, glycerine and clove oil.

    \begin{question}
    \paragraph{Question:} When $\mu = 1$ (air), what is the value of $\phi_2$? This should be taken as one of the points for plotting the above graph.
    \end{question}

\end{enumerate}

\subsection*{Part C (\textit{optional})}

In this part, you will use the data from \textbf{Part B} to determine the refractive index of the unknown liquid $A$.

\begin{enumerate}
    \item Measure the angle $\phi_2$ for the unknown liquid $A$, following a procedure similar to \textbf{Part A}.

    \item Use this value of $\phi_2$, along with the graph from \textbf{Part B}, to determine the refractive index of the liquid $A$.
\end{enumerate}

\section*{References}
% \begin{enumerate}
% \item Jearl D. Walker, \textit{Multiple rainbows from single drops of water and other liquids}, Am. J. Phys, 44 (5), 1976, pp. 421-433.
% \item Können, G.P., 2017: \textit{Rainbows, Halos, Coronas and Glories: Beautiful sources of information}, Bull. Amer. Meteor. Soc., 98, 2017, pp. 485–494.
% \item Kenneth Sassen, \textit{Angular scattering and rainbow formation in pendant drops}, J. Opt. Soc. Am., 69 (8), 1979, pp. 1083-1098.
% \item John Beynon, \textit{Introductory University Optics}, Prentice-Hall of India Pvt. Ltd., New Delhi, 1998, pp. 44-55.
% \item Francis W. Sears, \textit{Optics}, Asian Publishing House (India), 1958, pp. 54-55.

% \end{enumerate}

\nocite{khaparde_training_2008}
\nocite{walker_multiple_1976}
\nocite{konnen_rainbows_2017}
\nocite{sassen_angular_nodate}

\printbibliography[heading=none]

\newpage

\end{refsection}


\documentclass{beamer}
%
% Choose how your presentation looks.
%
% For more themes, color themes and font themes, see:
% http://deic.uab.es/~iblanes/beamer_gallery/index_by_theme.html
%
\mode<presentation>
{
  \usetheme{default}      % or try Darmstadt, Madrid, Warsaw, ...
  \usecolortheme{default} % or try albatross, beaver, crane, ...
  \usefonttheme{default}  % or try serif, structurebold, ...
  \setbeamertemplate{navigation symbols}{}
  \setbeamertemplate{caption}[numbered]
  \setbeamertemplate{footline}[frame number]
  \setbeamertemplate{itemize items}[circle]
  \setbeamertemplate{theorems}[numbered]
  \setbeamercolor*{structure}{bg=white,fg=blue}
  \setbeamerfont{block title}{size=\normalsize}
}

% \newtheorem{proposition}[theorem]{Proposition}
% \theoremstyle{definition}
% \newtheorem{algorithm}[theorem]{Algorithm}
% \newtheorem{idea}[theorem]{Idea}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{aligned-overset}
\usepackage{alltt}
\usepackage{amsmath}
\usepackage{csquotes}
% \usepackage{multicol}
% \usepackage{stmaryrd}
\usepackage{tabularx}

% \renewcommand\tabularxcolumn[1]{m{#1}}
% \newcolumntype{R}{>{\raggedleft\arraybackslash}X}=

\newcommand\logeq{\mathrel{\vcentcolon\Leftrightarrow}}
\def\code#1{\texttt{\frenchspacing#1}}
\def\padding{\vspace{0.5cm}}
\def\spadding{\vspace{0.25cm}}
\def\b{\textcolor{blue}}
\def\r{\textcolor{red}}
\def\g#1{{\usebeamercolor[fg]{block title example}{#1}}}

% fix for \pause in align
\makeatletter
\let\save@measuring@true\measuring@true
\def\measuring@true{%
  \save@measuring@true
  \def\beamer@sortzero##1{\beamer@ifnextcharospec{\beamer@sortzeroread{##1}}{}}%
  \def\beamer@sortzeroread##1<##2>{}%
  \def\beamer@finalnospec{}%
}
\makeatother

\title[Theoretical Computer Science]{Theoretical Computer Science \\ Context-Free Languages}
\author{Jonas Hübotter}
\date{}

\begin{document}

\begin{frame}
  \titlepage
\end{frame}

\begin{frame}{Outline}
 \tableofcontents[subsubsectionstyle=hide]
\end{frame}
% \AtBeginSection[]
%   {
%      \begin{frame}[allowframebreaks]{Plan}
%      \tableofcontents[currentsection, sectionstyle=show/hide, hideothersubsections]
%      \end{frame}
%   }

\section{Overview}

\begin{frame}{Overview}
    \begin{block}{Representations of context-free languages}\pause
        \begin{itemize}
            \item Context-Free Grammar (CFG)\pause
            \item Pushdown Automaton (PDA)
        \end{itemize}
    \end{block}
\end{frame}

\section{Context-Free Grammar (CFG)}

\subsection{Variables}

\begin{frame}{Variables}
    \begin{definition}
        Given a grammar $G = (V, \Sigma, P, S)$, a variable $X \in V$ is
        \begin{itemize}
            \item \b{generative} if $\exists X \to_G^* w \in \Sigma^*$\pause;
            \item \b{reachable} if $\exists S \to_G^* X$\pause; and
            \item \b{helpful} if it is generative and reachable.
        \end{itemize}
    \end{definition}
\end{frame}

\subsection{Inductive Definition}

\begin{frame}{Inductive Definition}
    Given a context-free grammar $G = (V, \Sigma, P, S)$ with $V = \{A_1, \dots, A_k\}$,\pause\par
    productions $A_i \to w_0 A_{i_1}w_1 \dots w_{n-1} A_{i_n} w_n$\pause\par
    correspond to \begin{align*}
        &u_1 \in L_G(A_{i_1}) \land \dots \land u_n \in L_G(A_{i_n}) \\
        &\implies w_0 u_1 w_1 \dots w_{n-1} u_n w_n \in L_G(A_i).
    \end{align*}\pause
    Hence, $L(G) = L_G(S)$.\pause\par\spadding
    Productions produce words \r{top-down},\par
    inductive definition \textit{produces} words \r{bottom-up}.
\end{frame}

\subsection{Decomposition Lemma}

\begin{frame}{Decomposition Lemma}
    \begin{lemma}[Decomposition Lemma]
        Any derivation of length $n$ of $\beta$ from $\alpha_1 \alpha_2$ may \textit{split} $\beta$ into two separately derivable parts $\beta_1$ and $\beta_2$ at any position.\pause\ Formally:
        \begin{align*}
            \alpha_1 \alpha_2 \to_G^n \beta \iff& \exists \beta_1, \beta_2, n_1, n_2.\ \beta = \beta_1 \beta_2 \land n = n_1 + n_2\ \land \\
                                                & \alpha_1 \to_G^{n_1} \beta_1 \land \alpha_2 \to_G^{n_2} \beta_2.
        \end{align*}
    \end{lemma}
\end{frame}

\subsection{Syntax Tree}

\begin{frame}{Syntax Tree}
    \begin{definition}
        A \b{syntax tree} of a derivation $\to_G$ given $G = (V, \Sigma, P, S)$ is a tree where\pause
        \begin{enumerate}
            \item every leaf is labeled with a symbol in $\Sigma \cup \{\epsilon\}$\pause;
            \item every inner node is labeled with $A \in V$,\par
                assuming its children are $X_1, \dots, X_n \in V \cup \Sigma \cup \{\epsilon\}$, $A \to X_1 \dots X_n \in P$\pause; and
            \item a leaf labeled $\epsilon$ is an only child of its parent.
        \end{enumerate}\pause\spadding
        The \b{border} of a syntax tree is the labels of its leafs concatenated from left to right.
    \end{definition}\pause
    \begin{align*}
        A \to_G^* w &\iff w \in L_G(A) \\
                    &\iff \exists\ \text{syntax tree with root } A \text{ and border } w.
    \end{align*}
\end{frame}

\begin{frame}{Syntax Tree}
    \begin{definition}
        \begin{itemize}
            \item A CFG $G$ is \b{ambiguous} if $\exists w \in L(G)$ that has two distinct syntax trees.
            \item A CFL $L$ is \b{inherently ambiguous} if every CFG $G$ with $L(G) = L$ is ambiguous.
        \end{itemize}
    \end{definition}
\end{frame}

\subsection{Chomsky Normal Form}

\begin{frame}{Chomsky Normal Form}
    \begin{definition}[Chomsky Normal Form]
        All productions are of the form $A \to a$ or $A \to BC$ for $a \in Sigma$ and $A,B,C \in V$.
    \end{definition}\pause

    \begin{block}{Algorithm to convert a CFG to Chomsky Normal Form ($\mathcal{O}(|P|^2)$)}
        \begin{enumerate}
            \item replace every $a \in \Sigma$ occurring in a production with length $>1$ by a non-terminal\pause
            \item replace $A \to B_1 \dots B_k$ (where $k>2$) with $A \to B_1 C_2, C_2 \to B_2, \dots, C_k \to B_k$\pause
            \item remove $\epsilon$-productions (i.e. $A \to \epsilon$)\pause
            \item remove chain productions (i.e. $A \to B$)
        \end{enumerate}
    \end{block}
\end{frame}

\subsection{Other Normal Forms}

\begin{frame}{Other Normal Forms}
    \begin{definition}[Greibach Normal Form]
        All productions are of the form $A \to a A_1 \dots A_n$ for $a \in Sigma$ and $A_1, \dots, A_n \in V$.
    \end{definition}\pause

    \begin{definition}[Backus-Naur Normal Form]
        Allows the use of regular expressions in productions (in addition to symbols).
    \end{definition}
\end{frame}

\subsection{Cocke-Younger-Kasami Algorithm (CYK)}

\begin{frame}{Cocke-Younger-Kasami Algorithm (CYK)}
    Solves the word problem for CFGs.\pause

    \begin{block}{Algorithm ($\mathcal{O}(|w|^3)$)}
        Given $G = (V, \Sigma, P, S)$ in Chomsky normal form and $w = a_1 \dots a_n \in \Sigma^*$.\pause\par
        Define $V_{ij} = \{A \in V \mid A \to_G^* a_i \dots a_j\}$ for $i \leq j$ as the set of all initial symbols that may be used to derive $a_i \dots a_j$.\pause\par
        Then $w \in L_G(A) \iff A \in V_{1n}$.\pause\par\spadding
        Recursive definition of $V_{ij}$:
        \begin{itemize}
            \item base: $V_{ii} = \{A \in V \mid (A \to a_i) \in P\}$\pause
            \item step: \begin{align*}
                V_{ij} = \{A \in V \mid \substack{\exists i \leq k < j, B \in V_{ik}, C \in V_{(k+1)j}.\ \\ (A \to BC) \in P}\}
            \end{align*}
        \end{itemize}
    \end{block}
\end{frame}

\section{Pushdown Automaton (PDA)}

\begin{frame}{PDA}
    \begin{definition}
        A \b{pushdown automaton (PDA)} $M = (Q, \Sigma, \Gamma, q_0, Z_0, \delta, F)$\pause\ consists of
        \begin{itemize}
            \item a finite set of \b{states} $Q$\pause;
            \item a (finite) \b{input alphabet} $\Sigma$\pause;
            \item a (finite) \b{stack alphabet} $\Gamma$\pause;
            \item an \b{initial state} $q_0 \in Q$\pause;
            \item an \b{initial stack element} $Z_0 \in \Gamma$\pause;
            \item a (partial) \b{transition function} $\delta: Q \times (\Sigma \cup \{\epsilon\}) \times \Gamma \to 2^{Q \times \Gamma^*}$\pause; and
            \item a set of \b{terminal (accepting) states} $F \subseteq Q$.
        \end{itemize}
    \end{definition}\pause
    Graphically, transitions are denoted as $a, Z/\alpha$ where $a \in \Sigma$ is the input, $Z \in \Gamma$ is the top stack element, and $\alpha \in \Gamma^*$ replaces $Z$ in the new stack.
\end{frame}

\begin{frame}{PDA}
    \begin{definition}
        The \b{configuration} of a PDA $M$ is a triple $(q, w, \alpha)$ where $q \in Q$ is its state, $w \in \Sigma^*$ is its remaining input, and $\alpha \in \Gamma^*$ is its stack.\pause\par\spadding
        The \b{initial configuration} of $M$ on input $w \in \Sigma^*$ is $(q_0,w,Z_0)$.
    \end{definition}\pause
    \begin{definition}
        The \b{transition relation} of a PDA $M$ is \begin{align*}
            (q,aw,Z\alpha) \to_M (q',w,\beta\alpha) &\quad\text{if } (q',\beta) \in \delta(q,a,Z) \\
            (q,w,Z\alpha) \to_M (q',w,\beta\alpha)  &\quad\text{if } (q',\beta) \in \delta(q,\epsilon,Z).
        \end{align*}
    \end{definition}
\end{frame}

\begin{frame}{PDA}
    \begin{definition}
        PDA $M$ \b{accepts} $w \in \Sigma^*$ with final state if \begin{align*}
            (q_0,w,Z_0) \to_M^* (f,\epsilon,\gamma) \quad\text{for } f \in F, \gamma in \Gamma^*.
        \end{align*}
        So, $L_F(M) = \{w \in \Sigma^* \mid \exists f \in F, \gamma \in \Gamma^*.\ (q_0,w,Z_0) \to_M^* (f,\epsilon,\gamma)\}$.
    \end{definition}\pause
    \begin{definition}
        PDA $M$ \b{accepts} $w \in \Sigma^*$ with empty stack if \begin{align*}
            (q_0,w,Z_0) \to_M^* (q,\epsilon,\epsilon) \quad\text{for } q \in Q.
        \end{align*}
        So, $L_{\epsilon}(M) = \{w \in \Sigma^* \mid \exists q \in Q.\ (q_0,w,Z_0) \to_M^* (q,\epsilon,\epsilon)\}$.
    \end{definition}\pause\padding
    \r{Both accepting conditions are equally powerful.}
\end{frame}

\subsection{Lemmas}

\begin{frame}{Lemmas}
    \begin{lemma}[Extension Lemma]
        Every derivation may occur as a sub-derivation of a larger derivation\pause:
        \begin{align*}
            (q,u,\alpha) \to_M^n (q',u',\alpha') \implies (q,uv,\alpha\beta) \to_M^n (q',u'v,\alpha'\beta).
        \end{align*}
    \end{lemma}\pause
    \begin{lemma}[Decomposition Lemma]
        Every derivation that empties the stack can be divided into sub-derivations that each remove a single symbol from the stack\pause:
        Given $(q,w,Z_1 \dots Z_k) \to_M^n (q',\epsilon,\epsilon)$\pause,\par
        then $\forall i \in [1,k].\ \exists u_i, p_i, n_i$ such that \begin{align*}
            (p_{i-1},u_i,Z_i) \to_M^{n_i} (p_i,\epsilon,\epsilon)
        \end{align*} with $w = u_1 \dots u_k$, $q = p_0$, $q_k = p_k$, and $n = \sum_{i=1}^k n_i$.
    \end{lemma}
\end{frame}

\subsection{CFG $\to$ PDA}

\begin{frame}{CFG $\to$ PDA}
    Given CFG $G = (V,\Sigma,P,S)$,\pause
    \begin{enumerate}
        \item bring all productions into the form \begin{align*}
            A \to b B_1 \dots B_k \quad\text{for } b \in \Sigma \cup \{\epsilon\}
        \end{align*}\pause
        \item define the PDA $M = (\{q\},\Sigma,V,q,S,\delta)$\pause\ with \begin{align*}
            \delta(q,b,A) = \{(q,\beta) \mid (A \to b \beta) \in P\}.
        \end{align*}
    \end{enumerate}\pause
    Then, $L(G) = L_{\epsilon}(M)$.
\end{frame}

\subsection{PDA $\to$ CFG}

\begin{frame}{PDA $\to$ CFG}
    Given PDA $G = (Q,\Sigma,\Gamma,q_0,Z_0,\delta,F)$,\pause\ define CFG $G = (V,\Sigma,P,S)$.\pause\par\spadding
    We define $V = Q \times \Gamma \times Q \cup \{S\}$ where each $[q,Z,p] \in V$ describes all possibilities of going from state $q \in Q$ to state $p \in Q$ while $Z \in \Gamma$ is the top stack element.\pause\par\spadding
    We define the productions $P$ as \begin{itemize}
        \item $\forall q \in Q.\ S \to [q_0,Z_0,q]$\pause\ and
        \item $\forall (r_0, Z_1 \dots Z_k) \in \delta(q,b,Z).\ \forall r_1, \dots, r_k \in Q.$\pause \begin{align*}
            [q,Z,r_k] \to b [r_0,Z_1,r_1][r_1,Z_2,r_2]\dots[r_{k-1},Z_k,r_k].
        \end{align*}
    \end{itemize}\pause\padding
    We observe that \begin{align*}
        [q,Z,r_k] \to_G^* w \iff (q,w,Z) \to_M^* (r_k,\epsilon,\epsilon).
    \end{align*}\pause
    So, $L(G) = L_{\epsilon}(M)$.
\end{frame}

\subsection{Deterministic Pushdown Automaton (DPDA)}

\section{Closure Properties}

\begin{frame}{Closure Properties}
    \begin{theorem}
        Given the context-free languages $L, L_1, L_2$, then the following are also centext-free languages:\pause
        \begin{itemize}
            \item $L_1 L_2$\pause;
            \item $L_1 \cup L_2$\pause; and
            \item $L^*$.
        \end{itemize}
    \end{theorem}\pause

    \begin{theorem}
        Given the deterministic context-free language $L$, then $\bar{L}$ is deterministic context-free.
    \end{theorem}
\end{frame}

\section{Pumping Lemma}

\begin{frame}{Pumping Lemma}
    \begin{lemma}[Pumping Lemma for context-free languages]
        Let $L \subseteq \Sigma^*$ be context-free.\pause\ Then there exists some $n > 0$ such that every $z \in L$ with $|z| \geq n$ can be decomposed into $z = uvwxy$\pause\ such that
        \begin{itemize}
            \item $vx \neq \epsilon$\pause;
            \item $|vwx| \leq n$\pause; and
            \item $\forall i \geq 0.\ uv^iwx^iy \in L$.
        \end{itemize}
    \end{lemma}\pause
    \r{A necessary condition for context-free languages.}
\end{frame}

\begin{frame}{Pumping Lemma}
    \begin{example}[proof structure]
        Assume $L$ is context-free.\par
        Let $n > 0$ be a Pumping Lemma number.\pause\par
        Choose $z \in L$ with $|z| \geq n$.\par
        Define $z = uvwxy$ with $vx \neq \epsilon$ and $|vwx| \leq n$.\pause\par
        Then, $\forall i \geq 0.\ uv^iwx^iy \in L$.\pause\par
        Now, use the last statement to find a contradiction separating all possible cases for $v$ and $x$.
    \end{example}
\end{frame}

\end{document}


\section{Background and Related Work}
\label{sec:background_and_related_work}

Separation logic is an extension of Floyd–Hoare logic, that has been around since 2002. \cite{reynolds_separation_2002} There have been many innovations related to it since then. Oracle semantics for concurrent separation logic \cite{drossopoulou_oracle_2008}, separation algebra for a language called concurrent C minor \cite{hutchison_fresh_2009},  Multimodal, and higher order separation logics as well. \cite{dockins_multimodal_2008,noauthor_higher_nodate} Especially in the last 4 or so years, there has been enough progress in the subject to warrant a paper to organize this "jungle" of separation logics. \cite{chang_bringing_2017} Fairly recent implementations have made it into VST (Verified Tool Chain), which is coded in the Coq programming language and proof management system. \cite{hutchison_verified_2012} VST is a tool chain that is being developed mostly for the verification and compilation of the C programming language. VST has many modules, all of which use some separation logic to some extent.

The first major chunk is a specification, a front end language called Verifiable C \cite{noauthor_verifiable_nodate}, which uses higher-order impredicative concurrent separation logic. Verifiable C works as a logical language that is mostly a restriction of the C language. Much like python 3 has what are called type hints \cite{noauthor_typing_nodate}, Verifiable C has constructs that help the underlying tool chain make more sense of C programs and verify their correctness. The next large section of code takes Verifiable C and checks for correctness. This part has parts called VST-FLoyd and a few other components. VST-Floyd is part of the core tactics of Verified C, and makes proving safety and correctness of C programs much more automatic. This section of code seems to have the ability to work outside of the C program verifying toolchain to also do separation logic operations as a Coq library. \cite{noauthor_princetonuniversityvst_2021}

On the back end is the last major chunk called CompCert, a C compiler that also uses separation logic in its compilation process. \cite{noauthor_compcert_nodate} This is not open source software and is owned by INRIA. It is a software project that is dual licensed. So I was not sure if contributions could be made to the software that would be welcome.

To understand this software stack I have found a series called Software Foundations. Software Foundations is a book series on solving, verifying, and some synthesis of programs with the Coq language. \cite{noauthor_software_nodate} There are 5 volumes covering these concepts. The most important for this project is volume 5: Verifiable C. There are also many manuals for parts of VST to go through, as needed. But it turns out the most useful way to learn VST and the Coq language was to look at the manuals for both languages. Software foundations is rated to take a semester for the first book, and potentially that long for each subsequent book. There was simply not enough time in the semester for this much reading.


\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{tikz}
\setlength{\parindent}{0pt}

\newtheorem*{theorem}{Theorem}
\newtheorem*{definition}{Definition}
\newtheorem*{lemma}{Lemma}
\newtheorem*{corollary}{Corollary}
\newtheorem{example}{Example}
\newtheorem{trick}{Trick}
\newtheorem{question}{Question}

\title{Problem Set 3}
\author{}
\date{}

\begin{document}

\begin{center}
{\rmfamily\bfseries\Large 18.02 EXERCISES}

\vspace{25px}

{\rmfamily\bfseries\LARGE Problem Set 3: Parametric Equations for Curves}
\end{center}

\begin{center}
\section*{Part I}
\end{center}

\subsection*{Unit 1E Equations of Lines and Planes}

\bigskip

4. Where does the line through $(0, 1, 2)$ and $(2, 0, 3)$ intersect the plane
$x + 4y + z = 4$?

Solution:

A vector along the line is $<2, -1, 1>$. Hence, the parametric equation of the
line is
\begin{equation*}
  \begin{cases}
    x = x(t) = 0 + 2t = 2t \\
    y = y(t) = 1 - t \\
    z = z(t) = 2 + t \\
  \end{cases}
\end{equation*}

For the intersection point of the line and the plane, it satisfies
\begin{gather*}
  x(t) + 4y(t) + z(t) = 4 \\
  2t + 4(1 - t) + 2 + t = 4 \\
  -t = -2 \\
  t = 2 \\
\end{gather*}

Therefore, the coordinates of the intersection point is $(x(2), y(2), z(2))$,
which is $(4, -1, 4)$.

\bigskip

7. Formulate a general method for finding the distance between two skew (i.e.,
non-intersecting) lines in space, and carry it out for two non-intersecting
lines lying along the diagonals of two adjacent faces of the unit cube (place it
in the first octant, with one vertex at the origin).

Solution:

7-1. Formulate a general method for finding the distance between two parallel
planes in space:

Suppose that the equations of two parallel planes are respectively
\begin{gather*}
  n_1x + n_2y + n_3z = c_1 \\
  n_1x + n_2y + n_3z = c_2 \\
\end{gather*}
Then the vector $\vec{n} = <n_1, n_2, n_3>$ is one of the normal vectors of the
two planes. Therefore, we can construct the parametric equation of a line
perpendicular to the two planes as
\begin{equation*}
  \begin{cases}
    x(t) = n_1t \\
    y(t) = n_2t \\
    z(t) = n_3t \\
  \end{cases}
\end{equation*}
Therefore, the two intersection points the line has with the two planes
respectively satisfy
\begin{gather*}
  n_1x(t_1) + n_2y(t_1) + n_3z(t_1) = c_1 \\
  n_1^2t_1 + n_2^2t_1 + n_3^2t_1 = c_1 \\
  t_1 = \frac{c_1}{n_1^2 + n_2^2 + n_3^2} \\
  n_1x(t_2) + n_2y(t_2) + n_3z(t_2) = c_2 \\
  n_1^2t_2 + n_2^2t_2 + n_3^2t_2 = c_1 \\
  t_2 = \frac{c_2}{n_1^2 + n_2^2 + n_3^2} \\
\end{gather*}
The distance between two points in the line can be calculated as
\begin{equation*}
  \begin{split}
    d &= \sqrt{(x(t_1) - x(t_2))^2 + (y(t_1) - y(t_2))^2 + (z(t_1) - z(t_2))^2} \\
      &= \sqrt{(n_1^2 + n_2^2 + n_3^2)(t_1 - t_2)^2} \\
      &= \sqrt{(n_1^2 + n_2^2 + n_3^2)(\frac{c_1 - c_2}{n_1^2 + n_2^2 + n_3^2})^2} \\
      &= \frac{|c_1 - c_2|}{\sqrt{n_1^2 + n_2^2 + n_3^2}} \\
      &= \frac{|c_1 - c_2|}{|\vec{n}|} \\
  \end{split}
\end{equation*}

7-2. Formulate a general method for finding the distance between two
non-parallel lines in space:

Suppose that there are two non-parallel lines in space named $l_a$ and $l_b$.
Their normal vectors are respectively
$\vec{n_a} = \langle n_{ax}, n_{ay}, n_{az} \rangle$ and
$\vec{n_b} = \langle n_{bx}, n_{by}, n_{bz} \rangle$, and their parametric
equations are respectively:
\begin{gather*}
  \begin{cases}
    x_a(t) = x_{a0} + n_{ax}t \\
    y_a(t) = y_{a0} + n_{ay}t \\
    z_a(t) = z_{a0} + n_{az}t \\
  \end{cases} \\
  \begin{cases}
    x_b(t) = x_{b0} + n_{bx}t \\
    y_b(t) = y_{b0} + n_{by}t \\
    z_b(t) = z_{b0} + n_{bz}t \\
  \end{cases} \\
\end{gather*}

Then we can find the vector $\vec{n}$ which is perpendicular to both $l_a$ and
$l_b$ by
\begin{equation*}
  \begin{split}
    \vec{n} &= \vec{n_a} \times \vec{n_b} \\
            &= \langle n_x, n_y, n_z \rangle \\
  \end{split}
\end{equation*}

Then the distance between $l_a$ and $l_b$ is equal to the distance between the
two planes $P_a$ and $P_b$ with $\vec{n}$ as their normal vectors where $l_a$
and $l_b$ lie within respectively.

The equation of $P_a$ is
\begin{equation*}
  n_x x + n_y y + n_z z = n_x x_{a0} + n_y y_{a0} + n_z z_{a0}
\end{equation*}

The equation of $P_b$ is
\begin{equation*}
  n_x x + n_y y + n_z z = n_x x_{b0} + n_y y_{b0} + n_z z_{b0}
\end{equation*}

According to the previous part, the distance between $P_a$ and $P_b$ is
\begin{equation*}
  \begin{split}
    d &= \frac{|(n_x x_{a0} + n_y y_{a0} + n_z z_{a0}) - (n_x x_{b0} + n_y y_{b0} + n_z z_{b0})|}{|\vec{n}|} \\
      &= \frac{|\vec{n} \cdot \langle (x_{a0} - x_{b0}), (y_{a0} - y_{b0}), (z_{a0} - z_{b0}) \rangle|}{|\vec{n}|} \\
      &= \frac{|\vec{n} \cdot \vec{A_0B_0}|}{|\vec{n}|} \\
      &= \frac{|(\vec{n_a} \times \vec{n_b}) \cdot \vec{A_0B_0}|}{|\vec{n_a} \times \vec{n_b}|} \\
  \end{split}
\end{equation*}

Therefore, the distance between $l_a$ and $l_b$ is
\begin{equation*}
  d = \frac{|(\vec{n_a} \times \vec{n_b}) \cdot \vec{A_0B_0}|}{|\vec{n_a} \times \vec{n_b}|}
\end{equation*}

7-3 Apply the above method to find the distance between two non-intersecting
lines lying along the diagonals of two adjacent faces of the unit cube (place it
in the first octant, with one vertex at the origin).

The two non-intersecting diagonals of two adjacent faces of the unit cube I
choose are the diagonal between $(0, 0, 0)$ and $(1, 0, 1)$, and the diagonal
between $(0, 1, 0)$ and $(0, 0, 1)$. Therefore, the parametric equations of
these two lines along the described diagonals are respectively:
\begin{gather*}
  \begin{cases}
    x_a(t) = t \\
    y_a(t) = 0 \\
    z_a(t) = t \\
  \end{cases} \\
  \begin{cases}
    x_b(t) = 0 \\
    y_b(t) = 1 - t \\
    z_b(t) = t \\
  \end{cases} \\
\end{gather*}

Therefore,
\begin{gather*}
  \vec{n_a} = \langle 1, 0, 1 \rangle \\
  \vec{n_b} = \langle 0, -1, 1 \rangle \\
  A_0 = (0, 0, 0) \\
  B_0 = (0, 1, 0) \\
  \vec{A_0B_0} = \langle 0, 1, 0 \rangle \\
\end{gather*}

Therefore, the distance between the two non-intersecting diagonals is
\begin{equation*}
  \begin{split}
    d &= \frac{|(\vec{n_a} \times \vec{n_b}) \cdot \vec{A_0B_0}|}{|\vec{n_a} \times \vec{n_b}|} \\
      &= \frac{|\langle 1, -1, -1 \rangle \cdot \langle 0, 1, 0 \rangle|}{|\langle 1, -1, -1 \rangle|} \\
      &= \frac{\sqrt{3}}{3} \\
  \end{split}
\end{equation*}

Therefore, the distance between the two non-intersecting diagonals of two
adjacent faces of the unit cube is $\frac{\sqrt{3}}{3}$.

\subsection*{Unit 1I Vector Functions and Parametric Equations}

\bigskip

1. The point $P$ moves with constant speed $v$ in the direction of the constant
vector $a \vec{i} + b \vec{j}$. If at time $t = 0$ it is at $(x_0, y_0)$, what
is its position vector function $\vec{r}(t)$?

Solution:

The direction of the constant vector $a \vec{i} + b \vec{j}$ is
\begin{equation*}
  dir(A) = \frac{a}{\sqrt{a^2 + b^2}} \vec{i} + \frac{b}{\sqrt{a^2 + b^2}} \vec{j}
\end{equation*}

Hence in a period of time $t$, the point $P$ moves in a distance of $vt$ in the
direction
$\langle \frac{a}{\sqrt{a^2 + b^2}}, \frac{b}{\sqrt{a^2 + b^2}} \rangle$. Hence
along the $x$-axis it moves in a distance of $\frac{a}{\sqrt{a^2 + b^2}} vt$,
and along the $y$-axis it moves in a distance of
$\frac{b}{\sqrt{a^2 + b^2}} vt$.

Therefore, the position vector function of the point $P$ is
\begin{equation*}
  \vec{r}(t) = \langle x_0 + \frac{a}{\sqrt{a^2 + b^2}} vt, y_0 + \frac{b}{\sqrt{a^2 + b^2}} vt \rangle
\end{equation*}

\bigskip

3. Describe the motions given by each of the following position vector
functions, as $t$ goes from $-\infty$ to $\infty$. In each case, give the
$xy$-equation of the curve along which $P$ travels, and tell what part of the
curve is actually traced out by $P$. \\
a) $\vec{r} = 2 \cos^2 t \vec{i} + \sin^2 t \vec{j}$ \\
b) $\vec{r} = \cos 2t \vec{i} + \cos t \vec{j}$ \\
c) $\vec{r} = (t^2 + 1) \vec{i} + t^3 \vec{j}$ \\
d) $\vec{r} = \tan t \vec{i} + \sec t \vec{j}$

Solution:

a) According to the position vector function,
\begin{gather*}
  x(t) = 2 \cos^2 t \\
  y(t) = \sin^2 t \\
\end{gather*}

Therefore, we can find the relation between $x$ and $y$:
\begin{gather*}
  \frac{x}{2} + y = 1 \\
  y = -\frac{1}{2}x + 1 \\
\end{gather*}
which is a line in the $xy$-plane.

Since the ranges of $x$ and $y$ are respectively
\begin{gather*}
  x \in [0, 2] \\
  y \in [0, 1] \\
\end{gather*}
the part of the curve that is actually traced out by $P$ is the line segment
from $(0, 0)$ to $(2, 1)$.

b) According to the position vector function,
\begin{gather*}
  x(t) = \cos 2t \\
  y(t) = \cos t \\
\end{gather*}

Therefore, we can find the relation between $x$ and $y$:
\begin{gather*}
  \cos 2t = 2 \cos^2 t - 1 \\
  x = 2 y^2 - 1 \\
\end{gather*}
which is a parabola in the $xy$-plane.

Since the range of $y$ is $y \in [-1, 1]$, and based on the characteristic of
the parabola $x = 2 y^2 - 1$, the part of the curve that is actually traced out
by $P$ is the part of the parabola between $(-1, 1)$ and $(1, 1)$.

c) According to the position vector function,
\begin{gather*}
  x(t) = t^2 + 1 \\
  y(t) = t^3 \\
\end{gather*}

Therefore, we can find the relation between $x$ and $y$:
\begin{equation*}
  y = (x - 1)^{\frac{3}{2}}
\end{equation*}
which is a symmetric graph related to the $x$ axis, in which the half above the
$x$ axis is the graph of a power function.

Since the range of $x$ is $x \in [1, \infty)$, which is the domain of the
function $y = (x - 1)^{\frac{3}{2}}$, the full curve is actually traced out by
$P$.

d) According to the position vector function,
\begin{gather*}
  x(t) = \tan t \\
  y(t) = \sec t \\
\end{gather*}

Therefore, we can find the relation between $x$ and $y$:
\begin{gather*}
  \sec^2 t - \tan^2 t = 1 \\
  y^2 - x^2 = 1 \\
\end{gather*}
which is a hyperbola.

According to the graph of $x(t)$ and $y(t)$, the full hyperbola is actually
traced out by $P$.

\begin{question}
  We know that the relation we find between $x$ and $y$ is correct, however, is
  it possible that $x$ and $y$ also satisfy other relation which is not
  equivalent to the one we find?
\end{question}

\bigskip

5. A string is wound clockwise around the circle of radius $a$ centered at the
origin $O$; the initial position of the end $P$ of the string is $(a, 0)$.
Unwind the string, always pulling it taut (so it stays tangent to the circle).
Write parametric equations for the motion of $P$.

Solution:

Since the string is wound clockwise, when we unwind it, the direction is
counter-clockwise. Also, since the string is unwound around a circle, it is
natural to use the parameter $\theta$ to describe the motion of $P$, where
$\theta$ is the corresponding angle of the unwound part of the string. Hence the
length of the unwound part of the string is $a \theta$.

During the unwinding, the string is always pulled taut, hence there is always a
point $P'$ on the circle which is the point of tangency between the circle and
the unwound part of the string. The coordinates of $P'$ can be described as
$(a \cos\theta, a \sin\theta)$.

Next we need to explore the direction of the vector $\vec{P'P}$ in order to
describe the coordinates of $P$. According to the tangency relationship between
the circle and the unwound part of the string,
\begin{gather*}
  \vec{P'P} \perp \vec{OP'} \\
  dir(\vec{OP'}) = \langle \cos\theta, \sin\theta \rangle \\
\end{gather*}

Therefore, we have the following system of equations
\begin{equation*}
  \begin{cases}
    dir(\vec{P'P}) \cdot \langle \cos\theta, \sin\theta \rangle = 0 \\
    |dir(\vec{P'P})| = 1 \\
  \end{cases}
\end{equation*}

After solving the above system of equations, there are two possible solutions:
\begin{gather*}
  dir(\vec{P'P}) = \langle \sin\theta, -\cos\theta \rangle \\
  dir(\vec{P'P}) = \langle -\sin\theta, \cos\theta \rangle \\
\end{gather*}

According to the geometric interpretation of unwinding the string
counter-clockwise, the correct direction of the vector $\vec{P'P}$ is
$\langle \sin\theta, -\cos\theta \rangle$.

Therefore, the parametric equation for the motion of $P$ is
\begin{equation*}
  \begin{cases}
    x(t) = a\cos\theta + a \theta \sin\theta \\
    y(t) = a\sin\theta - a \theta \cos\theta \\
  \end{cases}
\end{equation*}

\bigskip

7. The cycloid is the curve traced out by a fix point $P$ on a circle of radius
$a$ which rolls along the $x$-axis in the positive direction, starting when $P$
is at the origin $O$. Find the vector function $OP$; use as variable the angle
$\theta$ through which the circle has rolled.

Solution:

Let $C$ denote the center of the rolling circle. At a given value of $\theta$,
suppose that the tangency point between the circle and the $x$ axis is $A$.

Since the circle is rolling along the $x$ axis without any slip, then
\begin{equation*}
  OA = a \theta
\end{equation*}

Also $AC = a$, hence the coordinates of $C$ at the given value of $\theta$ is
\begin{equation*}
  C = (a \theta, a)
\end{equation*}

The direction of $\vec{CP}$ can be described by
\begin{gather*}
  dir(\vec{CP}) = \langle \cos(-\frac{\pi}{2} - \theta), \sin(-\frac{\pi}{2} - \theta) \rangle \\
  dir(\vec{CP}) = \langle -\sin\theta, -\cos\theta \rangle \\
\end{gather*}

Therefore, the parametric equation for the motion of $P$ is
\begin{equation*}
  \begin{cases}
    x(t) = a \theta - a \sin\theta \\
    y(t) = a - a \cos\theta \\
  \end{cases}
\end{equation*}

\subsection*{Unit 1J Differentiation of Vector Functions}

\bigskip

1. For each of the following vector functions of time, calculate the velocity,
speed $|ds/dt|$, unit tangent vector (in the direction of velocity), and
acceleration. \\
a) $e^t \vec{i} + e^{-t} \vec{j}$ \\
b) $t^2 \vec{i} + t^3 \vec{j}$ \\
c) $(1 - 2t^2) \vec{i} + t^2 \vec{j} + (-2 + 2t^2) \vec{k}$

Solution:

a)
\begin{gather*}
  \begin{split}
    \vec{v} &= \frac{d\vec{r}}{dt} \\
            &= \frac{d(e^t \vec{i} + e^{-t} \vec{j})}{dt} \\
            &= e^t \vec{i} - e^{-t} \vec{j} \\
  \end{split} \\
  \begin{split}
    |ds/dt| &= |\vec{v}| \\
            &= |e^t \vec{i} - e^{-t} \vec{j}| \\
            &= \sqrt{(e^t)^2 + (e^{-t})^2} \\
            &= \frac{\sqrt{e^{4t} + 1}}{e^t} \\
  \end{split} \\
  \begin{split}
    \vec{T} &= dir(\vec{v}) \\
            &= \frac{\vec{v}}{|\vec{v}|} \\
            &= \frac{e^{2t}}{\sqrt{e^{4t} + 1}} \vec{i} + \frac{1}{\sqrt{e^{4t} + 1}} \vec{j} \\
  \end{split} \\
  \begin{split}
    \vec{a} &= \frac{d\vec{v}}{dt} \\
            &= \frac{d(e^t \vec{i} - e^{-t} \vec{j})}{dt} \\
            &= e^t \vec{i} + e^{-t} \vec{j} \\
  \end{split} \\
\end{gather*}

b)
\begin{gather*}
  \begin{split}
    \vec{v} &= \frac{d\vec{r}}{dt} \\
            &= \frac{d(t^2 \vec{i} + t^3 \vec{j})}{dt} \\
            &= 2t \vec{i} + 3t^2 \vec{j} \\
  \end{split} \\
  \begin{split}
    |ds/dt| &= |\vec{v}| \\
            &= |2t \vec{i} + 3t^2 \vec{j}| \\
            &= \sqrt{(2t)^2 + (3t^2)^2} \\
            &= \sqrt{9t^4 + 4t^2} \\
  \end{split} \\
  \begin{split}
    \vec{T} &= dir(\vec{v}) \\
            &= \frac{\vec{v}}{|\vec{v}|} \\
            &= \frac{2t}{\sqrt{9t^4 + 4t^2}} \vec{i} + \frac{3t^2}{\sqrt{9t^4 + 4t^2}} \vec{j} \\
  \end{split} \\
  \begin{split}
    \vec{a} &= \frac{d\vec{v}}{dt} \\
            &= \frac{d(2t \vec{i} + 3t^2 \vec{j})}{dt} \\
            &= 2 \vec{i} + 6t \vec{j} \\
  \end{split} \\
\end{gather*}

c)
\begin{gather*}
  \begin{split}
    \vec{v} &= \frac{d\vec{r}}{dt} \\
            &= \frac{d((1 - 2t^2) \vec{i} + t^2 \vec{j} + (-2 + 2t^2) \vec{k})}{dt} \\
            &= -4t \vec{i} + 2t \vec{j} + 4t \vec{k} \\
  \end{split} \\
  \begin{split}
    |ds/dt| &= |\vec{v}| \\
            &= |-4t \vec{i} + 2t \vec{j} + 4t \vec{k}| \\
            &= \sqrt{(-4t)^2 + (2t)^2 + (4t)^2} \\
            &= 6|t| \\
  \end{split} \\
  \begin{split}
    \vec{T} &= dir(\vec{v}) \\
            &= \frac{\vec{v}}{|\vec{v}|} \\
            &= \begin{cases}
                 -\frac{2}{3} \vec{i} + \frac{1}{3} \vec{j} + \frac{2}{3} \vec{k} ,\ t \geq 0 \\
                 \frac{2}{3} \vec{i} - \frac{1}{3} \vec{j} - \frac{2}{3} \vec{k} ,\ t < 0 \\
               \end{cases} \\
  \end{split} \\
  \begin{split}
    \vec{a} &= \frac{d\vec{v}}{dt} \\
            &= \frac{d(-4t \vec{i} + 2t \vec{j} + 4t \vec{k})}{dt} \\
            &= -4 \vec{i} + 2 \vec{j} + 4 \vec{k} \\
  \end{split} \\
\end{gather*}

\bigskip

2. Let $OP = \frac{1}{1 + t^2} \vec{i} + \frac{t}{1 + t^2} \vec{j}$ be the
position vector for a motion. \\
a) Calculate $\vec{v}$, $|ds/dt|$, and $\vec{T}$. \\
b) At what point in the speed greatest? smallest? \\
c) Find the $xy$-equation of the curve along which the point $P$ is moving, and
describe it geometrically.

Solution:

a)
\begin{gather*}
  \begin{split}
    \vec{v} &= \frac{d\vec{r}}{dt} \\
            &= \frac{d(\frac{1}{1 + t^2} \vec{i} + \frac{t}{1 + t^2} \vec{j})}{dt} \\
            &= -\frac{2t}{(t^2 + 1)^2} \vec{i} + \frac{1 - t^2}{(t^2 + 1)^2} \vec{j} \\
  \end{split} \\
  \begin{split}
    |ds/dt| &= |\vec{v}| \\
            &= |-\frac{2t}{(t^2 + 1)^2} \vec{i} + \frac{1 - t^2}{(t^2 + 1)^2} \vec{j}| \\
            &= \sqrt{(-\frac{2t}{(t^2 + 1)^2})^2 + (\frac{1 - t^2}{(t^2 + 1)^2})^2} \\
            &= \frac{1}{t^2 + 1} \\
  \end{split} \\
  \begin{split}
    \vec{T} &= dir(\vec{v}) \\
            &= \frac{\vec{v}}{|\vec{v}|} \\
            &= -\frac{2t}{t^2 + 1} \vec{i} + \frac{1 - t^2}{t^2 + 1} \vec{j} \\
  \end{split} \\
\end{gather*}

b) According to the expression of the speed $|ds/dt|$, it is obvious that when
$t = 0$, the speed has its greatest value which is $1$, and when $t = \infty$ or
$t = -\infty$, the speed has its smallest value which is $0$.

c) According to the position vector function,
\begin{gather*}
  x(t) = \frac{1}{1 + t^2} \\
  y(t) = \frac{t}{1 + t^2} \\
\end{gather*}

Therefore, we can find the relation between $x$ and $y$ as
\begin{gather*}
  (\frac{1}{1 + t^2})^2 + (\frac{t}{1 + t^2})^2 = \frac{1 + t^2}{(1 + t^2)^2} = \frac{1}{1 + t^2} \\
  x^2 + y^2 = x \\
  x^2 - x + \frac{1}{4} + y^2 = \frac{1}{4} \\
  (x - \frac{1}{2})^2 + y^2 = \frac{1}{4} \\
\end{gather*}
which is a circle of radius $\frac{1}{2}$ centered at $(\frac{1}{2}, 0)$.

According to the graph of $x$ and $y$, the full circle is actually traced out by
the motion of $P$.

\bigskip

3. Prove the rule for differentiating the scalar product of two plane vector
functions:
\begin{equation*}
  \frac{d}{dt} \vec{r} \cdot \vec{s} = \frac{d\vec{r}}{dt} \cdot \vec{s} + \vec{r} \cdot \frac{d\vec{s}}{dt}
\end{equation*}
by calculating with components, letting $\vec{r} = x_1 \vec{i} + y_1 \vec{j}$,
and $\vec{s} = x_2 \vec{i} + y_2 \vec{j}$.

Solution:

\begin{gather*}
  \vec{r} \cdot \vec{s} = x_1 x_2 + y_1 y_2 \\
  \begin{split}
    \frac{d}{dt} \vec{r} \cdot \vec{s} &= \frac{d(x_1 x_2 + y_1 y_2)}{dt} \\
                                       &= \frac{d(x_1 x_2)}{dt} + \frac{d(y_1 y_2)}{dt} \\
                                       &= \frac{d x_1}{dt} x_2 + x_1 \frac{d x_2}{dt} + \frac{d y_1}{dt} y_2 + y_1 \frac{d y_2}{dt} \\
                                       &= (\frac{d x_1}{dt} x_2 + \frac{d y_1}{dt} y_2) + (x_1 \frac{d x_2}{dt} + y_1 \frac{d y_2}{dt}) \\
                                       &= (\langle \frac{d x_1}{dt}, \frac{d y_1}{dt} \rangle \cdot \langle x_2, y_2 \rangle) + (\langle x_1, y_1\rangle \cdot \langle \frac{d x_2}{dt}, \frac{d y_2}{dt}\rangle) \\
                                       &= \frac{d\vec{r}}{dt} \cdot d\vec{s} + \vec{r} \cdot \frac{d\vec{s}}{dt} \\
  \end{split} \\
\end{gather*}

Q.E.D.

\bigskip

4. Suppose a point $P$ moves on the surface of a sphere with center at the
origin; let
\begin{equation*}
  OP = \vec{r}(t) = x(t) \vec{i} + y(t) \vec{j} + z(t) \vec{k}
\end{equation*}

Show that the velocity vector $v$ is always perpendicular to $\vec{r}$ in two
different ways: \\
a) using the $x,y,z$-coordinates \\
b) without coordinates (use the formula in \textbf{1J-3}, which is also valid in
space).

Also Prove the converse: if $\vec{r}$ and $\vec{v}$ are perpendicular, then the
motion of $P$ is on the surface of a sphere centered at the origin.

Solution:

To prove that the velocity vector $v$ is always perpendicular to $\vec{r}$ for
the described motion of $P$:

a)
\begin{gather*}
  \begin{split}
    \vec{v}(t) &= \frac{d(\vec{r}(t))}{dt} \\
               &= \frac{d(x(t))}{dt} \vec{i} + \frac{d(y(t))}{dt} \vec{j} + \frac{d(z(t))}{dt} \vec{k} \\
  \end{split} \\
  \begin{split}
    \vec{r} \cdot \vec{v} &= (x(t) \vec{i} + y(t) \vec{j} + z(t) \vec{k}) \cdot (\frac{d(x(t))}{dt} \vec{i} + \frac{d(y(t))}{dt} \vec{j} + \frac{d(z(t))}{dt} \vec{k}) \\
                          &= x(t) \frac{d(x(t))}{dt} + y(t) \frac{d(y(t))}{dt} + z(t) \frac{d(z(t))}{dt} \\
  \end{split} \\
\end{gather*}

Since
\begin{gather*}
  \frac{d((x(t))^2)}{dt} = \frac{d(x(t))}{dt} x(t) + x(t) \frac{d(x(t))}{dt} \\
  \frac{d((x(t))^2)}{dt} = 2 x(t) \frac{d(x(t))}{dt} \\
  x(t) \frac{d(x(t))}{dt} = \frac{1}{2} \frac{d((x(t))^2)}{dt} \\
\end{gather*}
then
\begin{equation*}
  \begin{split}
    \vec{r} \cdot \vec{v} &= x(t) \frac{d(x(t))}{dt} + y(t) \frac{d(y(t))}{dt} + z(t) \frac{d(z(t))}{dt} \\
                          &= \frac{1}{2} \frac{d((x(t))^2)}{dt} + \frac{1}{2} \frac{d((y(t))^2)}{dt} + \frac{1}{2} \frac{d((z(t))^2)}{dt} \\
                          &= \frac{1}{2} \frac{d}{dt} ((x(t))^2 + (y(t))^2 + (z(t))^2) \\
  \end{split}
\end{equation*}

Since the point $P$ moves on the surface of a sphere with center at the origin, then
\begin{equation*}
  (x(t))^2 + (y(t))^2 + (z(t))^2 = R^2 ,\ \textnormal{R is the radius of the sphere}
\end{equation*}

Therefore,
\begin{equation*}
  \begin{split}
    \vec{r} \cdot \vec{v} &= \frac{1}{2} \frac{d}{dt} ((x(t))^2 + (y(t))^2 + (z(t))^2) \\
                          &= \frac{1}{2} \frac{d(R^2)}{dt} \\
                          &= 0 \\
  \end{split}
\end{equation*}
Hence the velocity vector $v$ is always perpendicular to $\vec{r}$. Q.E.D.

b)
\begin{gather*}
  \frac{d}{dt} (\vec{r} \cdot \vec{r}) = \frac{d\vec{r}}{dt} \cdot \vec{r} + \vec{r} \cdot \frac{d\vec{r}}{dt} \\
  \frac{d}{dt} (\vec{r} \cdot \vec{r}) = 2 \frac{d\vec{r}}{dt} \cdot \vec{r} \\
  \frac{d}{dt} (\vec{r} \cdot \vec{r}) = 2 \vec{v} \cdot \vec{r} \\
  \begin{split}
    \vec{v} \cdot \vec{r} &= \frac{1}{2} \frac{d}{dt} \vec{r} \cdot \vec{r} \\
                          &= \frac{1}{2} \frac{d}{dt} |\vec{r}|^2 \\
  \end{split}
\end{gather*}

Since the point $P$ moves on the surface of a sphere with center at the origin, then
\begin{equation*}
  |\vec{r}|^2 = R^2 ,\ \textnormal{R is the radius of the sphere}
\end{equation*}

Therefore,
\begin{equation*}
  \begin{split}
    \vec{r} \cdot \vec{v} &= \frac{1}{2} \frac{d}{dt} |\vec{r}|^2 \\
                          &= \frac{1}{2} \frac{d(R^2)}{dt} \\
                          &= 0 \\
  \end{split}
\end{equation*}
Hence the velocity vector $v$ is always perpendicular to $\vec{r}$. Q.E.D.

To prove that if $\vec{r}$ and $\vec{v}$ are perpendicular, then the motion of
$P$ is on the surface of a sphere centered at the origin:

\begin{gather*}
  \frac{d}{dt} (\vec{r} \cdot \vec{r}) = \frac{d\vec{r}}{dt} \cdot \vec{r} + \vec{r} \cdot \frac{d\vec{r}}{dt} \\
  \frac{d}{dt} (\vec{r} \cdot \vec{r}) = 2 \frac{d\vec{r}}{dt} \cdot \vec{r} \\
  \frac{d}{dt} (\vec{r} \cdot \vec{r}) = 2 \vec{v} \cdot \vec{r} \\
  \frac{d}{dt} (|\vec{r}|^2) = 2 \vec{v} \cdot \vec{r} \\
\end{gather*}

Since $\vec{r}$ and $\vec{v}$ are perpendicular, then
\begin{equation*}
  \vec{r} \cdot \vec{v} = 0
\end{equation*}

Therefore,
\begin{gather*}
  \begin{split}
    \frac{d}{dt} (|\vec{r}|^2) &= 2 \vec{v} \cdot \vec{r} \\
                               &= 0 \\
  \end{split} \\
  |\vec{r}|^2 = c ,\ \textnormal{c is a constant}
\end{gather*}

Therefore, the motion of the point $P$ is on a sphere of radius $\sqrt{c}$ with
center at the origin. Q.E.D.

\bigskip

5. a) Suppose a point moves with constant speed. Show that its velocity vector
and acceleration vector are perpendicular. (Use the formula in \textbf{1J-3}) \\
b) Show the converse: if the velocity and acceleration vectors are perpendicular,
the point $P$ moves with constant speed.

Solution:

a)
\begin{gather*}
  \frac{d}{dt} (\vec{v} \cdot \vec{v}) = \frac{d\vec{v}}{dt} \cdot \vec{v} + \vec{v} \cdot \frac{d\vec{v}}{dt} \\
  \frac{d}{dt} (\vec{v} \cdot \vec{v}) = 2 \frac{d\vec{v}}{dt} \cdot \vec{v} \\
  \frac{d}{dt} (\vec{v} \cdot \vec{v}) = 2 \vec{a} \cdot \vec{v} \\
  \begin{split}
    \vec{a} \cdot \vec{v} &= \frac{1}{2} \frac{d}{dt} \vec{v} \cdot \vec{v} \\
                          &= \frac{1}{2} \frac{d}{dt} |\vec{v}|^2 \\
  \end{split}
\end{gather*}

Since the described point moves with constant, then
\begin{gather*}
  |\vec{v}|^2 = c ,\ \textnormal{c is a constant} \\
  \begin{split}
    \vec{a} \cdot \vec{v} &= \frac{1}{2} \frac{d}{dt} |\vec{v}|^2 \\
                          &= 0 \\
  \end{split}
\end{gather*}

Hence the velocity vector $v$ is always perpendicular to the acceleration vector
$\vec{a}$. Q.E.D.

b)
\begin{gather*}
  \frac{d}{dt} (\vec{v} \cdot \vec{v}) = \frac{d\vec{v}}{dt} \cdot \vec{v} + \vec{v} \cdot \frac{d\vec{v}}{dt} \\
  \frac{d}{dt} (\vec{v} \cdot \vec{v}) = 2 \frac{d\vec{v}}{dt} \cdot \vec{v} \\
  \frac{d}{dt} (\vec{v} \cdot \vec{v}) = 2 \vec{a} \cdot \vec{v} \\
  \frac{d}{dt} (|\vec{v}|^2) = 2 \vec{a} \cdot \vec{v} \\
\end{gather*}

Since $\vec{a}$ and $\vec{v}$ are perpendicular, then
\begin{gather*}
  \vec{a} \cdot \vec{v} = 0 \\
  \begin{split}
    \frac{d}{dt} (|\vec{v}|^2) &= 2 \vec{a} \cdot \vec{v} \\
                               &= 0 \\
  \end{split} \\
  |\vec{v}|^2 = c ,\ \textnormal{c is a constant}
\end{gather*}

Therefore, the described point $P$ moves with constant speed. Q.E.D.

\bigskip

6. For the helical motion
$\vec{r}(t) = a \cos t \vec{i} + a \sin t \vec{j} + bt \vec{k}$, \\
a) calculate $\vec{v}$, $\vec{a}$, $\vec{T}$, $|ds/dt|$ \\
b) show that $\vec{v}$ and $\vec{a}$ are perpendicular; explain using
\textbf{1J-5}

Solution:

a)
\begin{gather*}
  \begin{split}
    \vec{v} &= \frac{d(\vec{r}(t))}{dt} \\
            &= \frac{d(a \cos t \vec{i} + a \sin t \vec{j} + bt \vec{k})}{dt} \\
            &= - a \sin t \vec{i} + a \cos t \vec{j} + b \vec{k} \\
  \end{split} \\
  \begin{split}
    \vec{a} &= \frac{d(\vec{v}(t))}{dt} \\
            &= \frac{d(- a \sin t \vec{i} + a \cos t \vec{j} + b \vec{k})}{dt} \\
            &= - a \cos t \vec{i} - a \sin t \vec{j} \\
  \end{split} \\
  \begin{split}
    |ds/dt| &= |\vec{v}(t)| \\
            &= |- a \sin t \vec{i} + a \cos t \vec{j} + b \vec{k}| \\
            &= \sqrt{(-a \sin t)^2 + (a \cos t)^2 + b^2} \\
            &= \sqrt{a^2 + b^2} \\
  \end{split} \\
  \begin{split}
    \vec{T} &= dir(\vec{v}) \\
            &= \frac{\vec{v}}{|\vec{v}|} \\
            &= \frac{- a \sin t \vec{i} + a \cos t \vec{j} + b \vec{k}}{\sqrt{a^2 + b^2}} \\
            &= - \frac{a}{\sqrt{a^2 + b^2}} \sin t \vec{i} + \frac{a}{\sqrt{a^2 + b^2}} \cos t \vec{j} + \frac{b}{\sqrt{a^2 + b^2}} \vec{k} \\
  \end{split}
\end{gather*}

b)
Since
\begin{equation*}
  \begin{split}
    \vec{v} \cdot \vec{a} &= (- a \sin t \vec{i} + a \cos t \vec{j} + b \vec{k}) \cdot (- a \cos t \vec{i} - a \sin t \vec{j}) \\
                          &= a^2 \sin t \cos t - a^2 \sin t \cos t + 0 \cdot b \\
                          &= 0 \\
  \end{split}
\end{equation*}
$\vec{v}$ and $\vec{a}$ are perpendicular.

According to the conclusion in \textbf{1J-5}, since we know that the speed of
the movement is constant, i.e.
\begin{equation*}
  |ds/dt| = \sqrt{a^2 + b^2}
\end{equation*}
then the velocity $\vec{v}$ and the accceleration $\vec{a}$ are perpendicular.

\bigskip

9. A point $P$ is moving in space, with position vector
\begin{equation*}
  \vec{r} = OP = 3 \cos t \vec{i} + 5 \sin t \vec{j} + 4 \cos t \vec{k}
\end{equation*} \\
a) Show it moves on the surface of a sphere. \\
b) Show its speed is constant. \\
c) Show the acceleration is directed toward the origin. \\
d) Show it moves in a plane through the origin. \\
e) Describe the path of the point.

Solution:

a) According to the position vector of the point $P$, the parametric equation of
the movement of the point $P$ is
\begin{equation*}
  \begin{cases}
    x(t) = 3 \cos t \\
    y(t) = 5 \sin t \\
    z(t) = 4 \cos t \\
  \end{cases}
\end{equation*}

Then the coordinates of the point $P$ satisfies
\begin{equation*}
  \begin{split}
    (x(t))^2 + (y(t))^2 + (z(t))^2 &= (3 \cos t)^2 + (5 \sin t)^2 + (4 \cos t)^2 \\
                                   &= 9 \cos^2 t + 25 \sin^2 t + 16 \cos^2 t \\
                                   &= 25 \\
  \end{split}
\end{equation*}

Therefore, the movement of the point $P$ is always on the surface of
$x^2 + y^2 + z^2 = 25$, which is a sphere.

b)
\begin{gather*}
  \begin{split}
    \vec{v} &= \frac{d(\vec{r}(t))}{dt} \\
            &= \frac{d(3 \cos t \vec{i} + 5 \sin t \vec{j} + 4 \cos t \vec{k})}{dt} \\
            &= - 3 \sin t \vec{i} + 5 \cos t \vec{j} - 4 \sin t \vec{k} \\
  \end{split} \\
  \begin{split}
    |ds/dt| &= |\vec{v}| \\
            &= |- 3 \sin t \vec{i} + 5 \cos t \vec{j} - 4 \sin t \vec{k}| \\
            &= \sqrt{(-3 \sin t)^2 + (5 \cos t)^2 + (-4 \sin t)^2} \\
            &= 5 \\
  \end{split}
\end{gather*}

c)
\begin{equation*}
  \begin{split}
    \vec{a} &= \frac{d(\vec{v}(t))}{dt} \\
            &= \frac{d(- 3 \sin t \vec{i} + 5 \cos t \vec{j} - 4 \sin t \vec{k})}{dt} \\
            &= -3 \cos t \vec{i} - 5 \sin t \vec{j} - 4 \cos t \vec{k} \\
  \end{split}
\end{equation*}

Therefore,
\begin{equation*}
  \vec{a} = - \vec{r} = -OP = PO
\end{equation*}

Since $\vec{r}$ is the vector from the origin to the point $P$, then at the
point $P$, $\vec{a}$, which has the reverse direction of $\vec{r}$, points back
to the origin.

d) According to the parametric equation of the point $P$ in part (a), the
coordinates of the point $P$ satisfy
\begin{equation*}
  4 x(t) + 0 y(t) - 3 z(t) = 4 \cdot 3 \cos t + 0 \cdot 5 \sin t - 3 \cdot 4 \cos t = 0
\end{equation*}

Therefore, the point $P$ moves in a plane through the origin whose normal vector is
$\langle 4, 0, -3 \rangle$.

e) Since the movement of the point $P$ is on the surface of a sphere whose
center is the origin, and also in a plane through the origin, then the path of
the point $P$ is the intersection of the two geometric objects, which is a
circle of radius 5 whose center is the origin.

The equation of the circle can be given as
\begin{equation*}
  \begin{cases}
    x^2 + y^2 + z^2 = 25 \\
    4x - 3z = 0 \\
  \end{cases}
\end{equation*}

\subsection*{Unit 1K. Kepler's Second Law}

\bigskip

2. Let $\vec{s}(t)$ be a vector function. Prove by using components that
\begin{equation*}
  \frac{d\vec{s}}{dt} = \vec{0} \ \Rightarrow \ \vec{s}(t) = \vec{K},\ \textnormal{where $\vec{K}$ is a constant vector.}
\end{equation*}

Solution:

Suppose that $\vec{s}(t) = x(t) \vec{i} + y(t) \vec{j} + z(t) \vec{k}$, then
\begin{equation*}
  \frac{d\vec{s}}{dt} = \frac{d(x(t))}{dt} \vec{i} + \frac{d(y(t))}{dt} \vec{j} + \frac{d(z(t))}{dt} \vec{k} = \vec{0}
\end{equation*}

which is equivalent to
\begin{equation*}
  \begin{cases}
    \frac{d(x(t))}{dt} = 0 \\
    \frac{d(y(t))}{dt} = 0 \\
    \frac{d(z(t))}{dt} = 0 \\
  \end{cases}
\end{equation*}

which is equivalent to
\begin{equation*}
  \begin{cases}
    x(t) = x_0,\ \textnormal{$x_0$ is a constant} \\
    y(t) = y_0,\ \textnormal{$y_0$ is a constant} \\
    z(t) = z_0,\ \textnormal{$z_0$ is a constant} \\
  \end{cases}
\end{equation*}

Therefore,
\begin{equation*}
  \begin{split}
    \vec{s}(t) &= x(t) \vec{i} + y(t) \vec{j} + z(t) \vec{k} \\
               &= x_0 \vec{i} + y_0 \vec{j} + z_0 \vec{k} \\
  \end{split}
\end{equation*}
where $x_0$, $y_0$, and $z_0$ are constants. Hence, $\vec{s}(t)$ is a constant
vector. Moreover, this conclusion is valid no matter how many dimensions the
vector has.

\begin{question}
  I believe the converse is also true. Prove it.
\end{question}

\bigskip

3. In our proof that Kepler's second law is equivalent to the force being
central, used the following steps to show the second law implies a central force.
Kepler's second law says the motion is in a plane and
\begin{equation*}
  2 \frac{dA}{dt} = |\vec{r} \times \vec{v}| \textnormal{ is constant.}
\end{equation*}

This implies $\vec{r} \times \vec{v}$ is constant. So,
\begin{equation*}
  0 = \frac{d}{dt}(\vec{r} \times \vec{v}) = \vec{v} \times \vec{v} + \vec{r} \times \vec{a} = \vec{r} \times \vec{a}
\end{equation*}

This implies $\vec{a}$ and $\vec{r}$ are parallel, i.e. the force is central.

Reverse the two steps to prove the converse: for motion under any type of
central force, the path of motion will lie in a plane and area will be swept out
by the radius vector at a constant rate.

Solution:

The motion is only under a central force \\
$\iff$ $\vec{r} \parallel \vec{a}$ \\
$\iff$ $\vec{r} \times \vec{a} = 0$

Therefore,
\begin{gather*}
  \vec{r} \times \vec{a} = 0 \\
  \vec{r} \times \vec{a} + \vec{v} \times \vec{v} = 0 \\
  \frac{d}{dt} (\vec{r} \times \vec{v}) = 0 \\
  \vec{r} \times \vec{v} = \vec{K},\ \textnormal{where $\vec{K}$ is a constant vector} \\
  \begin{cases}
    |\vec{r} \times \vec{v}| \textnormal{ is constant.} \\
    dir(\vec{r} \times \vec{v}) \textnormal{ is constant.} \\
  \end{cases}
\end{gather*}

Since
\begin{equation*}
  \begin{split}
    |\vec{r} \times \vec{v}| &= |\vec{r} \times \frac{d\vec{r}}{dt}| \\
                             &= \frac{|\vec{r} \times d\vec{r}|}{dt} \\
                             &= 2 \frac{dA}{dt} \\
  \end{split}
\end{equation*}

Then
\begin{equation*}
  |\vec{r} \times \vec{v}| \textnormal{ is constant.} \iff \frac{dA}{dt} \textnormal{ is constant.}
\end{equation*}

Since
\begin{equation*}
  dir(\vec{r} \times \vec{v}) \textnormal{ is constant.}
\end{equation*}

Then the normal vector of the plane determined by the position vector and the
velocity vector is constant. Hence the movement is always in the plane.

Q.E.D.

\begin{center}
\section*{Part II}
\end{center}

\bigskip

1. A circular disk of radius 2 has a dot marked at a point half-way between the
center and the circumference. Denote this point by $P$. Suppose that the disk is
tangent to the $x$-axis with the center initially at $(0, 2)$ and $P$ initially
at $(0, 1)$ and that it starts to roll to the right on the $x$-axis at unit
speed. Let $C$ be the curve traced out by the point $P$. \\
a) Make a sketch of what you think the curve $C$ will look like. \\
b) Use vectors to find the parametric equations for $\vec{OP}$ as a function of
time $t$. \\
c) Open the 'Mathlet' Wheel (with link on course webpage) and set the parameters
to view an animation of this particular motion problem. Then activate the
'Trace' function to see a graph of the curve $C$. If this graph is substantially
different from your hand sketch, sketch it also and then describe what led you
to produce your first idea of the graph.

\end{document}