More Optimization Problem . . .

A painting in an art gallery has height h and is hung so that its lower edge is a distance d above the eye of an observer. How far from the wall should the observer stand to get the best view? (In other words, where should the observer stand to maximize the angle theta subtended at his eye by the painting?)

I'm confident that I've worked the first part of the problem correctly, so I will just post my work for the part that I am having trouble with.

theta = a and beta = b

a = (a + b) - b

a = tan^-1(h + d/x) - tan^-1(d/x)

Da/dx = -(h + d)/(x^2 + h^2 + 2dh + d^2) +( )d/(x^2 + d^2)

=> -(h + d)(x^2 +d^2) + (d)(x^2 + h^2 + 2dh + d^2)/(x^2 + h^2 + 2dh + d^2)(x^2 + d^2)

For some reason, when I try to simplify this it just gets worse. Can someone please help me simplify this part, or just show me an easier way to go about this problem?

Thanks