Maximize the Viewing Angle | Calculus Optimization Problem
A classic problem in differential calculus is to find the optimal distance from a raised screen so that the viewing angle is maximized. The angle formed by the bottom of the screen, eye, and top of the screen will vary depending on three factors:
(1) the height of the screen
(2) the vertical distance between screen and eye
(3) the horizontal distance between screen and eye
Given that the height of the screen and the height of the screen above your eye are fixed quantities, the only variable to contend with is the distance from your eye to the screen. See image above. To find the best distance, you can set up and solve a simple calculus optimization problem.
Setting Up the Equation
Although most calculus textbooks present this problem with actual numbers for the screen height and height above the eye, we can solve all specific cases of this problem by letting these two numbers be arbitrary constants. Let the the height of the screen be H and the height above your eye be B. The variable, x, is the horizontal distance from your eye to the screen. See diagram below.
The viewing angle is a function of H, B, and x. It is the difference in angle between two right triangles. The larger of the two right triangles has a height of H+B and a width of x, the smaller of the two has a height of B and a width of x. The angles of these triangle with respect to the horizontal axis are respectively
angle 1 = arctan[(H+B)/x]
angle 2 = arctan[B/x]
and their difference θ is
θ = arctan[(H+B)/x] - arctan[B/x]
Here, θ is the viewing angle. Since θ is a function of the variable x, we can write equivalently
θ(x) = arctan[(H+B)/x] - arctan[B/x]
Thus, θ(x) is the equation we want to maximize using calculus. In this equation, H, B, and x are positive, so the domain we are examining is 0 ≤ x < ∞. See image below.
Maximizing the Equation: Finding the Critical Point(s)
To maximize θ(x) on the domain [0, ∞) we take its derivative, set the derivative equal to zero, solve for x, and then check to make sure that value of x is a maximum on this domain. Starting with the derivative we have
θ'(x) = -(H+B)/[(H+B)^2 + x^2] + B/[B^2 + x^2]
Now we set the derivative equal to zero and solve for x. Remember, H and B are constants in this equation, not variables.
0 = -(H+B)/[(H+B)^2 + x^2] + B/[B^2 + x^2]
(H+B)/[(H+B)^2 + x^2] = B/[B^2 + x^2]
(H+B)[B^2 + x^2] = B[(H+B)^2 + x^2]
(H+B)x^2 - Bx^2 = B(H+B)^2 - (H+B)B^2
Hx^2 = BH^2 + HB^2
x = ± sqrt(HB + B^2)
Related Calculus Tutorials
Since the domain is only non-negative values of x, the only critical point of this function on the given domain is at x = sqrt(HB + B^2). Now we just need to check that this is a maximum. This can be done by looking at a graph of θ(x) and checking that there is only one critical point on the domain [0, ∞) and that the critical point is a max. It can also be checked by taking the second derivative of θ(x), plugging in the critical point x = sqrt(HB + B^2) and checking that the result is negative, which indicates concave down curvature at that point, i.e., the point is a max. For this example problem, we will use the second derivative test.
Second Derivative Test for x = sqrt(HB + B^2)
The second derivative of θ(x) is
θ''(x) = 2x(H+B) / [(H+B)^2 + x^2]^2 - 2xB / [B^2 + x^2]^2
Plugginin the critical point x = sqrt(HB + B^2) into this function yeilds
2*sqrt(HB + B^2)(H+B) / [(H+B)^2 + HB + B^2]^2
- 2*sqrt(HB + B^2)B / [B^2 + HB +B^2]^2
After some simplification, this expression becomes
-2*sqrt(HB + B^2)*H / [B*(H+B)*(H+2B)^2]
which is negative for all positive values of H and B. Thus, the critical point x = sqrt(HB + B^2) is a maximum of the function θ(x) and the distance from the screen that yields the optimal viewing angle is sqrt(HB + B^2). This quantity is the geometric mean of H+B and B. Below is an example graph of θ(x) with H = 9 and B = 4, the max is at x = sqrt(52) ≈ 7.21.
Concrete Example Problem
You are on a boat in the ocean looking at a lighthouse. You want to find the optimal distance from the lighthouse to the boat so that you can get the best angle for a photo. The lighthouse is 67 meters tall and its base is 25 meters above the level of your eye. How far should you be from the lighthouse and what is the optimal viewing angle?
The angle to maximize is θ(x), where θ(x) = arctan((67+25)/x) - arctan(25/x), which simplifies to arctan(92/x) - arctan(25/x). See the simplified line diagram below.
Starting by taking the derivative we get
θ'(x) = -92/[92^2 + x^2] + 25/[25^2 + x^2]
and setting the derivative equal to zero we get
0 = -92/[92^2 + x^2] + 25/[25^2 + x^2]
92/[92^2 + x^2] = 25/[25^2 + x^2]
92[25^2 + x^2] = 25[92^2 + x^2]
67x^2 = 25*92^2 - 92*25^2 = 154100
x^2 = 154100/67 = 2300
x = sqrt(2300) ≈ 47.96
You can check that 47.96 is the geometric mean of H+B = 92 and B = 25. Therefore, the person on the boat should be about 47.96 meters from the lighthouse to get the best angle. Plugging x = 47.96 into the function θ(x) gives an optimal viewing angle of
θ = arctan(92/47.96) - arctan(25/47.96)
= 0.60973 radians
= 34.94 degrees