This is an optimization problem for some angle (call it θ) given a varying horizontal distance x, away from the painting. This means that θ is a function of x, and we must find a max value for θ, for some x. Similar to other optimization problems, the details of solving this involve taking the derivative of theta with respect to x, and setting that = 0, then solving for x. But let's first consider why there is even a maximum in the first place:
If we were to drape the painting so that it is level with the lens (or perhaps flush with the ground, if the lens in also on the ground), then we can think about how the angle changes as you move the lens farther away. What do you expect? You would probably say that as it gets farther away, that angle would strictly decrease, and vice versa if it gets closer. This is true. Moreover, as you get infinitely close to the painting, θ gets arbitrarily close to 90 degrees. However, this is not the case if you consider the lens to be any distance BELOW the bottom of the painting. Why? Because if that a lens is directly below a painting (or x = 0), and it tries to capture both the bottom and top of the painting, then it cannot do so. That is because the bottom and top are colinear with the lens. θ = 0 in this situation. So if θ = 0 out at infinity and θ = 0 for x = 0, and θ is always positive and continuous, there should be a value of x that provides a maximum theta.
The calculus gets a bit messy, but the idea is to take the derivative, and then set the numerator to 0, then solve for x.
Let L = height of the painting = 4,
and h = horizontal distance between lens and bottom of painting = 1
Show that θ = arctan[(l+h)/x] - arctan[(h)/x]
Then prove that dθ/dx = 0 if 0 = h(1 + (L+h)2x-2) - (L+h)(1 + h2x-2))
This is the hard part. It can be done if you use the form of the derivative of arctan, use the chain rule, set = 0, and ignore the denominator terms.
Solve for x, and you get a nice answer in terms of L and h, namely:
x = √( h(L+h) )