# Calculus/Optimization

 ← Related Rates Calculus Euler's Method → Optimization

## Introduction

Optimization is one of the uses of calculus in the real world. Perhaps we are a pizza parlor and wish to maximize profit. Perhaps we have a flat piece of cardboard and we need to make a box with the greatest volume. How does one go about this process?

This requires the use of maximums and minimums. We know that we find maximums and minimums via derivatives. Therefore, one can conclude that calculus will be a useful tool for maximizing or minimizing (collectively known as "optimizing") a situation.

In general, an optimization problem has a constraint that changes how we view the problem. The wording of the problem (whether subtle or not) can also drastically change how we view the problem. The constraint is the thing we will absolutely not change (such as the general shape, or the amount that we are willing to pay for the entire operation, etc.). If we can identify what we are going to change and what we are going to require stay the same, we will be on our way to solve the problem.

## How to Solve

These general steps should be taken in order to complete an optimization problem.

1. Write out necessary formulas and other pieces of information given by the problem.
• The problems should have a variable you control and a variable that you want to maximize/minimize.
• The formulas you find may contain extra variables. Depending on how the question works out, they may be substituted out or can be ignored (which will be explained later).
2. Combine the formulas together so that the variable you want to maximize/minimize is on one side of the equation and everything else on the other.
3. Differentiate the formula. If your equation has multiple variables, pick any variable to differentiate as long as it is not the one you control (i.e. pick the variable that you could not get rid of from the formula).
• Note that during differentiation, if you come across a variable that you have not picked, imagine it as a number and apply the necessary differentiation rule. Do not treat it as a variable in this case.
4. Set the differentiated formula to equal 0 and solve for the variable you control.
5. The value you get here is your answer. If you instead have another formula, that means that your answer depends on those other variables, which would usually be what the question asked for if you have such a situation that you have another variable to juggle to begin with.

The reason why this algorithm works comes from a few mathematical theorems which you will probably not need to know when completing these problems. Usually the problems given will be mathematically simple (in other words, there are not a lot of cases to test). However, if you wish to know, they work like this:

• A derivative of 0 is either a global or local maximum or minimum. Usually the question will tend towards answering that question without much difficulty (like always positive numbers, for example)

## Examples

### Volume Example

A box manufacturer desires to create a closed box with a surface area of 100 inches squared and with a square base yet rectangular sides. What is the maximum volume that can be formed by bending this material into a box?
• Write out known formulas and information
${\displaystyle A_{base}=x^{2}}$
${\displaystyle A_{side}=x\cdot h}$
${\displaystyle A_{total}=2x^{2}+4x\cdot h=100}$
${\displaystyle V=l\cdot w\cdot h=x^{2}\cdot h}$
• Write the variable ${\displaystyle h}$  in terms of ${\displaystyle x}$  in the volume equation.
${\displaystyle 2x^{2}+4xh=100}$
${\displaystyle x^{2}+2xh=50}$
${\displaystyle 2xh=50-x^{2}}$
${\displaystyle h={\frac {50-x^{2}}{2x}}}$
{\displaystyle {\begin{aligned}V&=\left(x^{2}\right)\left({\frac {50-x^{2}}{2x}}\right)\\&={\frac {50x-x^{3}}{2}}\end{aligned}}}
• Find the derivative of the volume equation in order to maximize the volume
${\displaystyle {\frac {dV}{dx}}={\frac {50-3x^{2}}{2}}}$
• Set ${\displaystyle {\frac {dV}{dx}}=0}$  and solve for ${\displaystyle x}$
${\displaystyle {\frac {50-3x^{2}}{2}}=0}$
${\displaystyle 50-3x^{2}=0}$
${\displaystyle 3x^{2}=50}$
${\displaystyle x=\pm {\frac {\sqrt {50}}{\sqrt {3}}}}$
• Plug-in the ${\displaystyle x}$  value into the volume equation and simplify
{\displaystyle {\begin{aligned}V&={\frac {1}{2}}\left[50{\sqrt {\frac {50}{3}}}-\left({\sqrt {\frac {50}{3}}}\right)^{3}\right]\\&=68.04138174...\end{aligned}}}
Answer: ${\displaystyle V_{max}=68.04138174...}$

### Volume Example II

It is desired to make an open-top box of greatest possible volume from a square piece of tin whose side is ${\displaystyle \alpha }$  by cutting equal squares out of the corners and then folding up the tin to form the sides. What should be the length of the side of a cut-out square?

If we call the side length of the cut-out squares ${\displaystyle x}$ , then each side of the base of the folded box is ${\displaystyle \alpha -2x}$ , and the height is ${\displaystyle x}$ . Therefore, the volume function is ${\displaystyle V(x)=x(\alpha -2x)^{2}=x(\alpha ^{2}-4\alpha x+4x^{2})=\alpha ^{2}x-4\alpha x^{2}+4x^{3}}$ . We must optimize the volume by taking the derivative of the volume function and setting it equal to 0. Since it does not change, ${\displaystyle \alpha }$  is treated as a constant, not a variable.

${\displaystyle V(x)=\alpha ^{2}x-4\alpha x^{2}+4x^{3}}$
{\displaystyle {\begin{aligned}0&=V'(x)=\alpha ^{2}-8\alpha x+12x^{2}\\&=12x^{2}-8\alpha x+\alpha ^{2}\end{aligned}}}

We can now use the quadratic formula to solve for ${\displaystyle x}$ :

${\displaystyle x={\frac {-b\pm {\sqrt {b^{2}-4ac}}}{2a}}}$
{\displaystyle {\begin{aligned}x&={\frac {-(-8\alpha )\pm {\sqrt {(-8\alpha )^{2}-4(12)(\alpha ^{2})}}}{2(12)}}\\&={\frac {8\alpha \pm {\sqrt {64\alpha ^{2}-48\alpha ^{2}}}}{24}}\\&={\frac {8\alpha \pm {\sqrt {16\alpha ^{2}}}}{24}}\\&={\frac {8\alpha \pm 4\alpha }{24}}\end{aligned}}}
${\displaystyle x={\frac {\alpha }{6}},{\frac {\alpha }{2}}}$

We reject ${\displaystyle x={\frac {\alpha }{2}}}$ , since it is a minimum (it results in the base length ${\displaystyle \alpha -2x}$  being 0, making the volume 0).

Therefore, the answer is ${\displaystyle x={\frac {\alpha }{6}}}$ .

### Volume Example III

A cylindrical can is required to hold ${\displaystyle 1.024{\text{ L}}}$  of liquid. Determine the measurements that will minimize the amount of material required to construct the can of specified volume.

This is a classic problem for optimization. The problem is we do not have any specified measurements. Luckily enough, we are given SI units, so we can write what we are given accordingly,

• Conversion factor: ${\displaystyle 1{\text{ L}}=1000{\text{ cm}}^{3}}$ . This means that through dimensional analysis (or basic algebra): ${\displaystyle 1.024{\text{ L}}=1024{\text{ cm}}^{3}}$ . Recall that this is the volume!
• Volume of a cylinder: ${\displaystyle V=\pi r^{2}h}$
• Surface area of a cylinder: ${\displaystyle S=2\pi rh+2\pi r^{2}}$

Recall what we are trying to minimize: "the amount of material required to construct the can of specified volume." This means the surface area needs to be minimized! The unfortunate part is we have two variables (it is not constant). Luckily, we can use the volume to write ${\displaystyle h}$  in terms of ${\displaystyle r}$ :

${\displaystyle 1024{\text{ cm}}^{3}=\pi r^{2}h}$
${\displaystyle \Rightarrow {\frac {1024{\text{ cm}}^{3}}{\pi {r{\text{ cm}}}^{2}}}={\frac {1024}{\pi r^{2}}}{\text{ cm}}=h}$

We can the substitute this information into the surface area formula and minimize (set the first derivative to zero):

${\displaystyle S(r)=2\pi r\left({\frac {1024}{\pi r^{2}}}\right)+2\pi r^{2}}$ . Eliminate the ${\displaystyle \pi }$  and ${\displaystyle r}$ .
${\displaystyle \Rightarrow S(r)=2\cdot {\frac {1024}{r}}+2\pi r^{2}}$  Set the first derivative equal to zero.
{\displaystyle {\begin{aligned}\Rightarrow 0=S'(r)&={\frac {d}{dr}}\left({\frac {2048}{r}}+2\pi r^{2}\right)\\&={\frac {d}{dr}}\left({\frac {2048}{r}}\right)+{\frac {d}{dr}}\left(2\pi r^{2}\right)\\&={\frac {d}{dr}}\left(2048\cdot {r}^{-1}\right)+2\pi {\frac {d}{dr}}\left(r^{2}\right)\\&=2048\cdot {\frac {d}{dr}}\left({r}^{-1}\right)+2\pi \left(2r\right)\\&=2048\cdot (-1){r}^{-2}+4\pi r\\&=-{\frac {2048}{{r}^{2}}}+4\pi r\\&={\frac {4\pi r^{3}-2048}{{r}^{2}}}\end{aligned}}}

All that is left to do is find the critical values of the operation. This ultimately means to let the numerator equal zero and find what values of ${\displaystyle r}$  make the denominator equal to zero. Here is the operation for the numerator:

${\displaystyle 4\pi r^{3}-2048=0}$
${\displaystyle \Leftrightarrow 4\pi r^{3}=2048}$
${\displaystyle \Leftrightarrow r^{3}={\frac {2048}{4\pi }}={\frac {512}{\pi }}}$
${\displaystyle \Leftrightarrow r={\sqrt[{3}]{\frac {512}{\pi }}}={\frac {8}{\sqrt[{3}]{\pi }}}\approx 5.4623}$

Here is the operation for the denominator:

${\displaystyle {r}^{2}=0}$
${\displaystyle r=\pm 0}$

Let us note that we do not care about one of the critical values being equal to zero. This problem is asking us to find the value that makes the condition true but also minimized. While zero does minimize the amount of material used to construct the can, we cannot make a can if we do not show one. This solution would be interesting, however, if we were asked about the graph of ${\displaystyle S(r)}$ . Nevertheless, our final answer may not necessarily be ${\displaystyle r\approx 5.4623{\text{ cm}}}$  and ${\displaystyle h\approx 10.9245{\text{ cm}}}$ . We need to verify that the critical value we found is the correct answer. That is where we substitute values for ${\displaystyle r\in \left(0,\,{\frac {8}{\sqrt[{3}]{\pi }}}\right)}$  and ${\displaystyle r\in \left({\frac {8}{\sqrt[{3}]{\pi }}},\,\infty \right)}$  into the first derivative:

For ${\displaystyle r\in \left(0,\,{\frac {8}{\sqrt[{3}]{\pi }}}\right)}$ , let ${\displaystyle r=5}$ : ${\displaystyle S'(5)={\frac {4\pi (5)^{3}-2048}{(5)^{2}}}<0}$ . For ${\displaystyle r\in \left({\frac {8}{\sqrt[{3}]{\pi }}},\,\infty \right)}$ , let ${\displaystyle r=6}$ : ${\displaystyle S'(6)={\frac {4\pi (6)^{3}-2048}{(6)^{2}}}>0}$ .

Based on these results above, it is clear that ${\displaystyle r={\frac {8}{\sqrt[{3}]{\pi }}}}$  is a value that minimizes the function such that it allows us to make a can. Keep in mind, if you do not show that the value we found is a minimum, then this value could also be a maximum. Imagine if that were the case, and we suggested the company to produce a can that would maximize the amount of material used. Potentially millions of dollars of material costs would offset the profit from the optimum. Either way, we have found our answers:

Answer: the radius is ${\displaystyle 5.4623{\text{ cm}}}$  and the height is ${\displaystyle 10.9245{\text{ cm}}}$ .

### Sales Example

A small retailer can sell ${\displaystyle n}$  units of a product for a revenue of ${\displaystyle r(n)=8.1n}$  and at a cost of ${\displaystyle c(n)=n^{3}-7n^{2}+18n}$ , with all amounts in thousands. How many units does it need to sell to maximize its profit?

The retailer's profit is defined by the equation ${\displaystyle p(n)=r(n)-c(n)}$ , which is the net revenue generated. The question asks for the maximum amount of profit, or the maximum of the above equation. As previously discussed, the maxima and minima of a graph are found when the slope of the said graph is equal to zero. To find the slope, one finds the derivative of the function of interest – here, ${\displaystyle p(n)}$ . By using the subtraction rule ${\displaystyle p'(n)=r'(n)-c'(n)}$ :

${\displaystyle p(n)=r(n)-c(n)}$
${\displaystyle p'(n)={\frac {d}{dn}}[8.1n]-{\frac {d}{dn}}\left[n^{3}-7n^{2}+18n\right]=-3n^{2}+14n-9.9}$

Therefore, when ${\displaystyle -3n^{2}+14n-9.9=0}$  the profit will be maximized or minimized. Use the quadratic formula to find the roots, giving ${\displaystyle n=0.869,3.798}$ . To find which of these is the maximum and minimum the function can be tested:

${\displaystyle p(0.869)=-3.97321,p(3.798)=8.58802}$

Because we only consider the functions for all ${\displaystyle n\geq 0}$  (i.e., you can't have ${\displaystyle n=-5}$  units), the only points that can be minima or maxima are those two listed above. To show that ${\displaystyle 3.798}$  is in fact a maximum (and that the function doesn't remain constant past this point) check if the sign of ${\displaystyle p'(n)}$  changes at this point.

### Distance of Function to Origin

A typical optimization problem, although a little abstract.
The function ${\displaystyle f(x)={\sqrt {4-x}}}$  is graphed in the ${\displaystyle xy}$  plane. At what point of the function should a particle living on it stop so that the straight line distance from that point to the origin is minimized?

Let us write all the relevant equations we might want to keep in mind:

• ${\displaystyle D={\sqrt {\left(x_{2}-x_{1}\right)^{2}+\left(y_{2}-y_{1}\right)^{2}}}}$
• ${\displaystyle y=f(x)}$

The problem with optimization problems is that most of the time, you work with two variables as opposed to one. However, the main idea and focus is to write the two-variable equation into a single-variable equation. It is important to relate the variables here. The best way to do this is by using the set-up of the problem to your advantage.

We want to leave the function at ${\displaystyle (x,y)}$  and minimize the distance required to reach the origin. This means we let ${\displaystyle \left(x_{2},y_{2}\right)=(x,y)}$ . Recall that the origin is at ${\displaystyle (0,0)}$ , so ${\displaystyle \left(x_{1},y_{1}\right)=(0,0)}$ . With all the information we have here, let us go ahead and write the distance function in terms of ${\displaystyle x}$  the singular variable. Because ${\displaystyle y=f(x)}$ :

{\displaystyle {\begin{aligned}D(x)&={\sqrt {\left(x-0\right)^{2}+\left(f(x)-0\right)^{2}}}\\&={\sqrt {x^{2}+\left({\sqrt {4-x}}\right)^{2}}}\\&={\sqrt {x^{2}+4-x}}\\&={\sqrt {x^{2}-x+4}}\end{aligned}}}

We will show two ways to take the derivative: the standard way and the non-standard way. The standard way will require us to use the chain rule, so let us demonstrate this procedure:

#### Standard way

${\displaystyle D(x)={\sqrt {x^{2}-x+4}}}$
${\displaystyle \Rightarrow {\frac {d}{dx}}\left[D(x)\right]={\frac {d}{dx}}\left({\sqrt {x^{2}-x+4}}\right)}$
{\displaystyle {\begin{aligned}\Rightarrow D'(x)&={\frac {d}{dx}}\left({\sqrt {x^{2}-x+4}}\right)&\left({\text{Recall the chain rule: }}{\frac {d}{dx}}\left[f\left(g(x)\right)\right]={\frac {df}{dg}}\cdot {\frac {dg}{dx}}\right)\\&={\frac {d}{dx}}\left(x^{2}-x+4\right)\cdot {\frac {df}{dg}}\left({\sqrt {x^{2}-x+4}}\right)\\&=\left(2x-1\right)\cdot {\frac {1}{2{\sqrt {x^{2}-x+4}}}}\\&={\frac {2x-1}{2{\sqrt {x^{2}-x+4}}}}\end{aligned}}}

We now have the first derivative of the distance formula. To minimize the distance between ${\displaystyle (x,y)}$  and the origin, set the first derivate equal to zero. By now, you should know why we have to do this:

Let ${\displaystyle D'(x)=0}$ .
${\displaystyle {\frac {2x-1}{2{\sqrt {x^{2}-x+4}}}}=0}$  implies the numerator is zero. As such:
Let ${\displaystyle 2x-1=0}$ .
${\displaystyle 2x-1=0}$
${\displaystyle \Leftrightarrow 2x=1}$
${\displaystyle \Leftrightarrow x={\frac {1}{2}}}$
Recall that if the denominator can be set equal to zero, then the value for ${\displaystyle x}$  which makes that true is a critical value. As such, let ${\displaystyle 2{\sqrt {x^{2}-x+4}}=0}$ :
${\displaystyle 2{\sqrt {x^{2}-x+4}}=0}$
${\displaystyle \Rightarrow {\sqrt {x^{2}-x+4}}=0}$
${\displaystyle \Rightarrow x^{2}-x+4=0}$
There is no real value for ${\displaystyle x}$  which makes the above equation true. This can be shown using the determinant is less than zero: ${\displaystyle b^{2}-4ac<0}$ . As such,

The only critical value is ${\displaystyle x={\frac {1}{2}}}$ . By now, you should be saying that we need to use the first derivative test:

For any ${\displaystyle x<{\frac {1}{2}}}$ , ${\displaystyle D'(x)<0}$ . For any ${\displaystyle x>{\frac {1}{2}}}$ , ${\displaystyle D'(x)>0}$ . This implies the function before the critical value is decreasing, and the function after the critical value is increasing. This implies the function at the critical value is a local minimum.

As such, the ${\displaystyle x}$ -value that will minimize the distance between ${\displaystyle (x,y)}$  and the origin is ${\displaystyle x={\frac {1}{2}}}$ .

However, you have not finished the question yet. You still have to find the point of the function that the particle needs to stop at. This is simply a matter of substitution into the function ${\displaystyle f(x)}$ :

{\displaystyle {\begin{aligned}f\left({\frac {1}{2}}\right)&={\sqrt {4-\left({\frac {1}{2}}\right)}}\\&={\sqrt {{\frac {8}{2}}-{\frac {1}{2}}}}\\&={\sqrt {\frac {7}{2}}}\end{aligned}}}

Most teachers in calculus classes don't mind if you leave the answer as ${\displaystyle \left({\frac {1}{2}},{\sqrt {\frac {7}{2}}}\right)}$ . However, for the minuscule number of teachers or testing organizations that care about rationalizing the denominator, the work for ${\displaystyle {\sqrt {\frac {7}{2}}}}$  is done below:

{\displaystyle {\begin{aligned}{\sqrt {\frac {7}{2}}}&={\frac {\sqrt {7}}{\sqrt {2}}}\\&={\frac {\sqrt {7}}{\sqrt {2}}}\cdot {\frac {\sqrt {2}}{\sqrt {2}}}\\&={\frac {{\sqrt {7}}\cdot {\sqrt {2}}}{2}}\\&={\frac {\sqrt {14}}{2}}\\\end{aligned}}}

This is the reason most teachers don't mind if the denominator is left as a square root; it distracts from the calculus (although slightly). This leaves us with the final answer:

The particle must leave the function at ${\displaystyle \left({\frac {1}{2}},{\frac {\sqrt {14}}{2}}\right)}$  to minimize the distance required to get to the origin.${\displaystyle \blacksquare }$

#### Non-standard way: implicit differentiation

Only the implicit differentiation will be shown, since any calculations beyond that would result in the same procedures we outlined before. Recall ${\displaystyle D(x)={\sqrt {x^{2}-x+4}}}$ . Square both sides to return the function seen below:

${\displaystyle \left[D(x)\right]^{2}=x^{2}-x+4}$

Taking the derivative of the above function with respect to ${\displaystyle x}$  will require us to implicitly differentiate (although this differentiation is neatly disguised). The calculations are demonstrated below:

${\displaystyle {\frac {d}{dx}}\left[\left(D(x)\right)^{2}\right]={\frac {d}{dx}}\left(x^{2}-x+4\right)}$
{\displaystyle {\begin{aligned}\Rightarrow 2D(x){\frac {dD}{dx}}&={\frac {d}{dx}}\left(x^{2}\right)-{\frac {d}{dx}}\left(x\right)+{\frac {d}{dx}}\left(4\right)\\&=2x-1+0\\\end{aligned}}}
${\displaystyle 2D(x){\frac {dD}{dx}}=2x-1}$
{\displaystyle {\begin{aligned}\Leftrightarrow {\frac {dD}{dx}}&={\frac {2x-1}{2D(x)}}\\&={\frac {2x-1}{2{\sqrt {x^{2}-x+4}}}}\end{aligned}}}

Notice how the calculation above resulted in the same first derivative when done the standard way, meaning the calculations from herein will be the same. With this let us move on to the next problem.

### Maximizing the Rectangular Area Formed by a Curved Shelf

The problem here is a disguised variation of another problem.
Let there be a function ${\displaystyle f(x)=15\log(x)}$  that describes the curve of one part of a stylized shelf. The curve ends ${\displaystyle 100}$  centimeters horizontal of the vertical wall. The manufacturer wants the front face of this portion to have one large maximum rectangular indentation whereby the top-left corner of the indentation forms a horizontal part that is parallel to the shelf's bottom. How far from the left-hand side of the shelving unit must the vertical wall formed in between be such that the condition set by the manufacturer is true? A calculator may be used here.

This problem seems very weird. However, in actuality, this is a disguised variation of another common optimization problem, the maximum rectangular area formed by a function problem. The problem becomes much more manageable when thinking about it in those terms. What the manufacturer wants, after all, is a maximized indentation size. It is not asking about the volume of that size, only the part where you can find this is actually true.

The image shown on the right is actually the maximum area formed. However, if the problem did not provide an image (and no numbers on the axes), then one would not be approximating.

Let ${\displaystyle x}$  be the distance from the left-hand side of the shelving unit, and let the height of the rectangle formed be ${\displaystyle y=f(x)}$ . Such a construction means that ${\displaystyle (100-x)}$  is the length of the rectangle while the height is ${\displaystyle 15\log(x)}$ . Therefore, the area function is

${\displaystyle A(x)=15(100-x)\log(x)}$

We want to find the maximum of the function given herein. Let us find the derivative of the area and set it equal to zero:

${\displaystyle A(x)=15(100-x)\log(x)}$
${\displaystyle \Rightarrow {\frac {d}{dx}}\left[A(x)\right]={\frac {d}{dx}}\left[15(100-x)\log(x)\right]}$
{\displaystyle {\begin{aligned}\Rightarrow A'(x)&=15{\frac {d}{dx}}\left((100-x)\log(x)\right)&\left({\text{Recall the product rule: }}{\frac {d}{dx}}\left[f(x)\cdot g(x)\right]=f\cdot {\frac {dg}{dx}}+g\cdot {\frac {df}{dx}}\right)\\&=15\left[(100-x)\cdot {\frac {d}{dx}}\left(\log(x)\right)+\log(x)\cdot {\frac {d}{dx}}\left(100-x\right)\right]\\&=15\left[{\frac {100-x}{x\ln(10)}}-\log(x)\right]\\&=15\left[{\frac {100-x}{x\ln(10)}}-{\frac {\ln(x)}{\ln(10)}}\right]&\left({\text{Multiply by }}{\frac {x}{x}}{\text{ to the right fraction.}}\right)\\&=15\left[{\frac {100-x}{x\ln(10)}}-{\frac {x\ln(x)}{x\ln(10)}}\right]\\&=15\left[{\frac {100-x-x\ln(x)}{x\ln(10)}}\right]=0\\\end{aligned}}}

However, after finding the first derivative, it is evident that finding the value for ${\displaystyle x}$  in this specific situation is unknown to us at this time because we do not know about the Lambert-W Function. Therefore, a graphing calculator is acceptable to use now (typically, many teachers want to see as much work as possible before allowing you to use the calculator for solutions). If one does not have a graphing calculator, use Desmos or Geogebra or the many other online graphing calculators.

The answer obtained by those websites is ${\displaystyle x\approx 23.94721}$  or an exact answer of ${\displaystyle x=e^{W(100e)-1}}$ . We know this is also the maximum that we are looking for because the derivative function is positive for ${\displaystyle x<23.94721}$  but negative after it. For those curious, the maximum area is ${\displaystyle 1573.44277}$  centimeters-squared.

Answer: ${\displaystyle x\approx 23.94721}$

### Velocity in Different Regions

The diagram of what we are trying to find: the distance ${\displaystyle \Lambda }$  required to reach the destination in the least amount of time.
A light ray, according to Fermat's Principle of Least Time, travels in the fastest time over the least amount of distance (i.e. a light ray travels the path that results in the least amount of time wasted). The speed of a light wave is defined as the speed of light to the refractive index of the material traveled, or ${\displaystyle v={\frac {c}{n}}}$ . Let a light wave travel through two materials, starting at ${\displaystyle n_{1}}$  and ending at ${\displaystyle n_{2}}$  where ${\displaystyle n_{1} . The angle of incidence and refraction is given on the diagram to the right. What is the relationship between the light ray traveling through the two different materials?

This does not seem like an optimization problem. In fact, it seems that trying to make this into an optimization problem would be unintuitive. However, this beautiful result in physics is but a clever discovery found by making this into an optimization problem.

Let us write what we know:

• The distance between the point of incidence and the change in the material is ${\displaystyle \Upsilon }$  (The diagram has an italicized capital upsilon).
• The distance that minimizes the travel time the most is ${\displaystyle \Lambda }$  (The diagram has an italicized capital lambda). This means the remaining horizontal distance, according to the diagram, is ${\displaystyle d-\Lambda }$ .
• The distance between the change in materials and the end of the refractive material is ${\displaystyle \Gamma }$  (The diagram has an italicized capital gamma).

All that is left to do is put it all together. We want to find the distance that light travelled.

• The distance travelled by the incident ray is ${\displaystyle {\sqrt {(\Lambda )^{2}+(\Upsilon )^{2}}}}$ .
• The distance travelled by the refractive ray is ${\displaystyle {\sqrt {(d-\Lambda )^{2}+(\Gamma )^{2}}}}$ .

Let us review what we know. We are trying to manipulate ${\displaystyle \Lambda }$  so that the time travelled is as small as possible to reflect and model how light ravels through two different materials. Everything else that is not a function of ${\displaystyle \Lambda }$  is a constant. Since we are trying to model the amount of time it takes light to travel through two different materials, we should manipulate the distances so that it models time.

Recall that speed is a ratio between distance and time ${\displaystyle \left(v={\frac {D}{\Delta t}}\right)}$ , so to model the amount of time light took to travel with the given distances, all it means is some rearrangements. Because light travelled through two different materials, the speeds are different. Let ${\displaystyle v_{1}>v_{2}}$  where ${\displaystyle v_{1}}$  is the speed of light traveling through the first material of index of refraction ${\displaystyle n_{1}}$  (and similar for ${\displaystyle v_{2}}$ ).

• ${\displaystyle t_{1}={\frac {\sqrt {\Lambda ^{2}+\Upsilon ^{2}}}{v_{1}}}}$
• ${\displaystyle t_{2}={\frac {\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}{v_{2}}}}$

The time light took to travel through the two materials is given as a function of ${\displaystyle \Lambda }$ , so

• ${\displaystyle T(\Lambda )=t_{1}+t_{2}={\frac {\sqrt {\Lambda ^{2}+\Upsilon ^{2}}}{v_{1}}}+{\frac {\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}{v_{2}}}}$

We now finally have an optimization problem. We want to minimize the amount of time travelled. Set the first derivative of ${\displaystyle T(\Lambda )}$  equal to zero. Remember, everything else besides ${\displaystyle \Lambda }$  is a constant.

${\displaystyle T(\Lambda )={\frac {\sqrt {\Lambda ^{2}+\Upsilon ^{2}}}{v_{1}}}+{\frac {\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}{v_{2}}}}$
${\displaystyle {\frac {d}{d\Lambda }}\left[T(\Lambda )\right]={\frac {d}{d\Lambda }}\left({\frac {\sqrt {\Lambda ^{2}+\Upsilon ^{2}}}{v_{1}}}+{\frac {\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}{v_{2}}}\right)}$
{\displaystyle {\begin{aligned}0=T'(\Lambda )&={\frac {d}{d\Lambda }}\left({\frac {\sqrt {\Lambda ^{2}+\Upsilon ^{2}}}{v_{1}}}+{\frac {\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}{v_{2}}}\right)\\&={\frac {d}{d\Lambda }}\left({\frac {\sqrt {\Lambda ^{2}+\Upsilon ^{2}}}{v_{1}}}\right)+{\frac {d}{d\Lambda }}\left({\frac {\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}{v_{2}}}\right)\\&={\frac {1}{v_{1}}}\cdot {\frac {d}{d\Lambda }}\left({\sqrt {\Lambda ^{2}+\Upsilon ^{2}}}\right)+{\frac {1}{v_{2}}}\cdot {\frac {d}{d\Lambda }}\left({\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}\right)\\&={\frac {1}{v_{1}}}\cdot \left({\frac {2\Lambda }{2{\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}}}\right)+{\frac {1}{v_{2}}}\cdot \left({\frac {2(d-\Lambda )\cdot (-1)}{2{\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}}}\right)\\&={\frac {1}{v_{1}}}\cdot \left({\frac {\Lambda }{\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}}\right)-{\frac {1}{v_{2}}}\cdot \left({\frac {d-\Lambda }{\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}}\right)\end{aligned}}}

Recall what we are trying to solve for. We are not trying to solve for ${\displaystyle \Lambda }$ ; we are trying to model the situation. If we did have to solve for ${\displaystyle \Lambda }$ , it would be a nightmare (we may even leave it as a non-trivial exercise for the reader), but nevertheless, we can begin modeling the situation. First, move the negative term to the other side:

${\displaystyle {\frac {1}{v_{1}}}\cdot \left({\frac {\Lambda }{\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}}\right)-{\frac {1}{v_{2}}}\cdot \left({\frac {d-\Lambda }{\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}}\right)=0}$
${\displaystyle {\frac {1}{v_{1}}}\cdot \left({\frac {\Lambda }{\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}}\right)={\frac {1}{v_{2}}}\cdot \left({\frac {d-\Lambda }{\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}}\right)}$

The diagram relating to the angles involved as a result of applying different geometric properties.

The next thing we should attempt to do is rewrite the expression so that we clean-up those fractions (they are intimidating after all, and it would not be practical to model).

We can use the trigonometric functions to help us here in this department. Because the trigonometric functions are simply relations of the ratio of a right triangle, this would be a very good solution.

The normal is defined as the line perpendicular a given "surface". Because the distance ${\displaystyle \Upsilon }$  is parallel to the normal, the angle generated by that is also ${\displaystyle 90^{\circ }}$ . Because the horizontal distance ${\displaystyle d}$  light travelled is parallel to the "surface," the incident angle of the light, ${\displaystyle \theta _{1}}$ , is an angle between the distance ${\displaystyle \Upsilon }$  and the incident light vector ${\displaystyle \mathbf {I} }$ , and the light vector ${\displaystyle \mathbf {I} }$  is a transversal, by the corresponding angles theorem, the angle between the distance ${\displaystyle \Upsilon }$  and the incident light vector ${\displaystyle \mathbf {I} }$  is also ${\displaystyle \theta _{1}}$  (see the upper-left corner of the diagram for reference).

The result of this geometric derivation is simply this: we have found an angle of part of a right triangle. As a result, we can write the distance as a trigonometric equivalent

• ${\displaystyle \sin(\theta _{1})={\frac {\Lambda }{\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}}}$

We can use similar logic to show that

• ${\displaystyle \sin(\theta _{2})={\frac {d-\Lambda }{\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}}}$

As a result, we can rewrite the equations involved into something much more manageable and easy to calculate without measuring ratios:

${\displaystyle {\frac {1}{v_{1}}}\cdot \left({\frac {\Lambda }{\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}}\right)={\frac {1}{v_{2}}}\cdot \left({\frac {d-\Lambda }{\sqrt {(d-\Lambda )^{2}+\Gamma ^{2}}}}\right)}$
${\displaystyle \Leftrightarrow {\frac {1}{v_{1}}}\cdot \sin(\theta _{1})={\frac {1}{v_{2}}}\sin(\theta _{2})}$

We are technically not done with the problem. Although we may have related the two different light vectors, we did not model the situation in terms of index of refractions. This leaves us with the two final steps. Recall the speed of light going through a certain material of index of refraction ${\displaystyle n}$  is ${\displaystyle v={\frac {c}{n}}}$ . This is equivalent to saying ${\displaystyle {\frac {1}{v}}={\frac {n}{c}}}$ . Since the speeds relate to the index of refraction, we may rewrite the above equation as

${\displaystyle {\frac {n_{1}\cdot \sin(\theta _{1})}{c}}={\frac {n_{2}\cdot \sin(\theta _{2})}{c}}}$

Multiply both sides by ${\displaystyle c}$  and we finally found Snell's Law:

Answer: ${\displaystyle n_{1}\sin(\theta _{1})=n_{2}\sin(\theta _{2})}$

Keep in mind, this result is still a derivative. However, we are allowed to model real life scenarios in terms of differential equations. Sometimes, it may be impossible to model situations without differential equations. We are allowed to write our equation like this (physics certainly does not care here). Finally, although this is not strictly an optimization problem, thinking about in that sense allowed us to obtain a nice rule of the world (a law in science). We proved this behavior, so it seems light will be consistent according to this equation. This in effect has allowed us to confirm in 2003 that negative index of refraction exists (even through experimental observations)[1] and allowed us to discover properties of spin waves[2].

## References

1. Houck, A. A., Brock, J. B., & Chuang, I. L. (2003). Experimental observations of a left-handed material that obeys Snell’s law. Physical Review Letters, 90(13), 137401. Retrieved 25 July 2020 from http://feynman.mit.edu/ike/homepage/papers/METAMAT-houck-brock-chuang-experimental-observations-of-a-left-handed-material-that-obeys-snells-law-prl-v90-p137401-04apr03.pdf.
2. Stigloher, J., Decker, M., Körner, H. S., Tanabe, K., Moriyama, T., Taniguchi, T., ... & Ono, T. (2016). Snell’s law for spin waves. Physical review letters, 117(3), 037204. Retrieve 22 July 2020 from https://arxiv.org/pdf/1606.02895.pdf.
 ← Related Rates Calculus Euler's Method → Optimization