Finding the widest angle to shoot a soccer ball from the sideline using optimization 
I'm trying to do an independent project for my Math class, but I was stuck and couldn't figure out how to use optimization to find position along the sideline that gives the widest angle to shoot. As in the picture, A and C demonstrate positions that provide smaller angle to shoot, while B provides a wider angle to shoot.  I tried using law of cosine, but because both sides of triangles change every times I didn't know how to apply optimization to it :(
if anyone know, please help, any suggestion would be appreciate 
 A: Using just trigonometry and the derivative:
Let $h_0$ be the distance from the corner of the field to the near goalpost, and $h_1$ be the distance from the corner to the far goalpost.  (The goal is $h_1-h_0$ wide.)  And let $x$ be the distance from the corner to your kicking point on the sideline.  The angle you want to maximize is: $$f(x)=\arctan(h_1/x)-\arctan(h_0/x).$$
To find the maximum you need $f'(d)=0$, this is necessary but not sufficient.  Fortunately $\arctan$ has an easy derivative: $\frac{d}{dx}\arctan(x)=\frac{1}{1+x^2}$, so we can calculate by the chain rule
$$\frac{d}{dx}\arctan(h/x)=-\frac{h}{h^2+x^2}.$$  So for $f'(x)=0$ you must have $$\frac{h_0}{h_0^2+x^2}=\frac{h_1}{h_1^2+x^2},$$ which a little algebra solves (for its positive solution) as $$x=\sqrt{\frac{h_0h_1^2-h_1h_0^2}{h_1-h_0}}=\sqrt{h_0h_1}.$$
It's apparent that this is in fact the maximizer you are looking for.
A: Construct a circle that passes through each goalpost, and is tangent to the sideline. Then $B$ is the point where the circle touches the sideline.
This is because the goalposts subtend the same angle for all points on the circle (as depicted in this GIF from the Wikipedia article Inscribed angle). Points $A$ and $C$ lie outside this circle, so they see a smaller angle.
To find the centre of the circle, draw a line bisecting the pitch lengthwise and find the point on this line that is distance $h$ from a goalpost, where $2h$ is the width of the pitch (use Pythagoras for this). And from the centre of the circle, you can drop a perpendicular to the sideline to find $B$.
Edited to add: Jeff Snider has answered your question using a completely different method. I suggest that you try to verify that our different approaches give the same answer.
