# Hints and review to problem set 1

1.a) $y = A \sin x + B \cos x - \frac{1}{3}\cos 2x$

1.b) $y = Ae^x + Be^{-x} - \frac{1}{2}xe^x$.

2.a) $y = \sinh x/\sinh 1$

2.b) $y = x^4 + 1$

2.c) This one can be done in several ways; $y = -\frac{1}{2} x + 1$. Note a second boundary condition can be derived by going back to the derivation of the EL equations and finding the natural boundary condition.

3. Like 2.c), it's best to go back to the derivation of the EL equations and use the natural boundary conditions. The solution is $y = \frac{1}{2} x^2 + a x + 1$, where $a = -7/4$ follows from the natural BC. Alternatively, re-substitute the parabola and extremize for $a$.

4. Unique solution $y = x$; infinitely many solutions; unattainable extremum; no solutions; unique solution $y = \sin x/\sin 1$; unique solution $y = x$.

5.a) Use the fact that $\de{x}/\de{s} = \cos\psi$ and $\de{y}/\de{s} = \sin\psi$. Now differentiate the relation $\sin\psi = Ac(x),$

with respect to $s$ to obtain $\cos\psi \frac{\de \psi}{\de s} = A \frac{\de c}{\de s}.$

Simplification then gives the desired result.

5.b) Let $A: (x_A, y_A)$ and $B: (x_B, y_B)$ be the initial and final points, respectively and let us assume that the boundary that separates the two regions is given by $\gamma = [\tilde{x}(s), \tilde{y}(s)]$. Assuming that the fastest route within each of the fields is a straight line, then the total travel distance is \begin{multline*} T(s) = \frac{1}{c_1} \sqrt{[\tilde{x}(s) - x_A]^2 + [\tilde{x}(s) - y_A]^2} \\ + \frac{1}{c_2} \sqrt{[\tilde{x}(s) - x_B]^2 + [\tilde{x}(s) - y_B]^2}, \end{multline*}

which depends on the choice, $s$, of where do do the crossover. Finding the extrema of this function thus gives \begin{multline*} T'(s) = \frac{\tilde{x}'(s)[\tilde{x}(s)-x_A] + \tilde{y}'(s)[\tilde{y}(s)-y_A]}{c_1\sqrt{[\tilde{x}(s) - x_A] + [\tilde{x}(s) - y_A]}} \\ + \frac{\tilde{x}'(s)[\tilde{x}(s)-x_B]^2 + \tilde{y}'(s)[\tilde{y}(s)-y_B]^2}{c_2\sqrt{[\tilde{x}(s) - x_B]^2 + [\tilde{x}(s) - y_B]^2}} = 0. \end{multline*}

In fact, this gives the solution, but we have to recognize it. One easy way is to note that there is no inherent orientation of the coordinate system (since the desired results only depend on the normals of the curve $\gamma$). Thus, we can make the simplifying assumption that $\tilde{x}'(s) = 0$, meaning that at the point $P$, the boundary is entirely vertical. This gives

$\frac{\tilde{y}(s)-y_A}{c_1\sqrt{[\tilde{x}(s) - x_A]^2 + [\tilde{x}(s) - y_A]^2}} =\frac{y_B-\tilde{y}(s)}{c_2\sqrt{[\tilde{x}(s) - x_B]^2 + [\tilde{x}(s) - y_B]^2}},$

which we can recognize as $\frac{\sin\psi_1}{c_1} = \frac{\sin\psi_2}{c_2}.$ </spoiler>

5.c) Let $\theta = \theta(s)$ be the angle of the trajectory as a function of its arclength, $s$, computed relative to the positive $x$-axis. As we walk along the trajectory, we encounter different values of $c = c(s)$, which indicates the local speed. What we would like to do is vary $s$, then see how $\psi$ and $c$ responds to this.

Consider the three 'adjacent' level sets $c(s - \delta s)$, $c(s)$, and $c(s + \delta s)$. Consider the initial point on the first level set and the final point on the third level set. Assuming that $\delta s$ is small, we can assume that the trajectories within the two regions are straight lines and so part b) applies. We thus conclude $\frac{\sin [\theta(s) - \alpha(s)]}{c(s)} = \frac{\sin [\theta(s + \delta s) - \alpha(s)]}{c(s + \delta s)}.$

Notice that we use $\alpha(s)$ in the second and not $\alpha(s + \delta s)$ because the second angle is computed still relative to the line $c(s)$. We now Taylor expand: \begin{multline*} \frac{\sin [\theta(s) - \alpha(s)]}{c(s)} = \frac{\sin [\theta(s) - \alpha(s)]}{c(s)} \\ \qquad \qquad + (\delta s) \left[\frac{\sin [\theta - \alpha]}{c^2(s)}c'(s) - \frac{\cos[\theta - \alpha]}{c(s)} \theta'(s)\right] + \mathcal{O}(\delta s)^2, \end{multline*}

and so:

$\theta'(s) = \frac{\sin[\theta - \alpha] }{c(s) \cos[\theta - \alpha]} \frac{\de{c}}{\de{s}}$

We are pretty much done. The only thing left is manipulation of trigonometric identities. First, we have two basic results for the tangent to the trajectory, $\mathbf{s}$, and the normal at the boundary of the constant curve $c(s)$, given by \begin{gather*} \mathbf{s} = (\cos\theta, \sin\theta) \\ \mathbf{n} = (\cos\alpha, \sin\alpha) = \frac{\nabla c}{|\nabla c|}. \end{gather*}

Next, we know that $\frac{\de{c}}{ds} = \mathbf{s} \cdot \nabla c = \mathbf{n} \cdot \mathbf{s} |\nabla c| = \cos(\theta - \alpha) |\nabla c|.$

Thus, \begin{align*} \theta'(s) &= \sin[\theta - \alpha] \frac{|\nabla c|}{c} \\ &= \sin[\theta - \alpha] \frac{|\nabla c|}{c} \\ &= (\sin\theta, -\cos\theta) \cdot \mathbf{n} \frac{|\nabla c|}{c} \\ &= (\sin\theta, -\cos\theta) \cdot \nabla \log c. \end{align*} </spoiler>

5.d) We wish to minimize $I[y] = \int F(x,y,y') \, \de{x} = \int \frac{\sqrt{1 + y'^2}}{c(x,y)} \, \de{x},$

where we can assume that the final path does not contain a vertical tangent. The Euler-Lagrange equations give $\frac{\de}{\de x} \left[ \frac{y'}{c\sqrt{1+y'^2}}\right] = \frac{\partial}{\partial y} \left[ \frac{\sqrt{1+y'^2}}{c(x,y)}\right].$

Computing the derivatives and simplifying then gives $\frac{y''}{(1 + y'^2)^{3/2}} = \frac{[y', -1]}{\sqrt{1 + y'^2}} \frac{\nabla c}{c},$

which is the result we want.

6. EL equations give $y = A\sinh x + B\sin x$, $z = A \sinh x - B\sin x$, and applying the boundary conditions gives $B = 0$ and $A = 1/\sinh(\pi/2)$