Maximum of subtended angle $\theta$ Following Problem, from Jim Fowler's Mooculus class:
A painting is mounted on a wall. The bottom of the painting is 5 feet above eye level, and the top of the painting is 14 feet above eye level. If you stand directly underneath the painting, you cannot see it at all. Similarly, if you stand very far away, you cannot see it very well. At some distance away from the wall, the angle subtended by the painting, whose vertex is your eye, is maximized. How far away must you stand from the wall to achieve this maximal viewing angle?
I draw this picture
And reason that 
$$
\cos \theta = \dfrac{14}{\sqrt{5^2+x^2}}\\
\theta = \arccos{\dfrac{14}{\sqrt{5^2+x^2}}}\\
\dfrac{d\theta}{dx} = \dfrac{d}{dx}\arccos{\dfrac{14}{\sqrt{5^2+x^2}}}\\
\dfrac{d\theta}{dx} =\frac{14 x}{\sqrt{1 - \frac{196}{x^{2} + 25}} \left(x^{2} + 25\right)^{\frac{3}{2}}}
$$
I use sympy to get the last step. When I solve $\dfrac{d\theta}{dx}=0$, I only get $x=0$, which is obviously not the correct solution. 
Tips?
 A: Your expression for $\cos\theta$ isn't correct, since the cosine ratio holds only in right triangles.
Observe that the angle $\theta$ is given by
$$\theta=\tan^{-1}\left(\frac{19}{x}\right)-\tan^{-1}\left(\frac{5}{x}\right)=\tan^{-1}\left(\frac{14x}{x^2+95}\right)$$
Since we want to maximize, we want to find the values for which $\theta$ is maximized, or for which $$\tan\theta=\frac{14x}{x^2+95}$$ is maximized.
I am sure you can take it from here.
A: There's a particularly sweet answer to this question: 
Draw a line at height $(5+14)/2 = 9.5$. For any point $P$ on this line, you can construct a circle with center $P$ that passes through the top and bottom of the painting. When $P$ is close to the painting's wall, the circle is small; when $P$ is far away, the circle's large. There's SOME point $P$ where the circle is exactly tangent to the eye-level-line; that's the point at which the subtended angle is largest, by a standard theorem about chords and angles from Euclidean geometry. 
Given that description, you can find the location of $P$, and its projection onto the floor is the ideal point to stand. 
(I heard this problem in the form of "where should the soccer player place the ball on the sideline to maximize the chance of getting it into the goal?", although that's rather less realistic, since you don't usually aim for the goal from the sideline...)
A: This is a standard problem: Regiomontanus' angle maximization problem
A: The entire height of the triangle is 14 feet, which includes the 5 feet. So in the answer, the 19 should be 14 ("upper" height minus "lower" height), the 14 should be 9 (just the "upper" height), and the 95 should be 70 (from 14 x 5)
A: First top of the picture is 14' above the eye level, not 19'.
Solution:
y = arctan(14/x) - arctan(5/x)
y' = 14*x^2/(x^2+144) - 5*x^2/(x^2+25)n = 0
x = sqrt(70)
A: This is an interesting problem.  
Using the approach mentioned by John Hughes above, the midlevel of the picture is at a height $9.5$ above the eye level. This is also equal to the radius of the optimal circle whose tangent is at eye-level.  Also, the midlevel of the picture is $4.5$ higher than the bottom of the painting.
A basic sketch shows that, by Pythagoras' theorem, 
$$x^2=9.5^2-4.5^2=70\\
x=\sqrt{70}\qquad\blacksquare$$
