Finding the maximum area of polygon? Firstly , I divided the polygon to three triangles and I used the  Heron's formula to find the area of triangles which formed the polygon $$A=\sqrt{p(p-a)(p-b)(p-c)}$$.I couldn't  find easily the relationship between $d$ and area for the three triangles.  Now I need the distance $d$ which give me a maximum area of polygon. 


$$ h1=\sqrt{5^2-(\frac{d}{2})^2} \\$$upper triangle area is $$ s1=\frac{1}{2}d\sqrt{5^2-(\frac{d}{2})^2}$$
$$h2=\sqrt{4^2-(\frac{d-5}{2})^2}\\$$so 2 lower triangle area =$$s2=2*\frac{1}{2}\frac{d-5}{2}\sqrt{4^2-(\frac{d-5}{2})^2} $$ rectangle area is =$$s3=5*\sqrt{4^2-(\frac{d-5}{2})^2} $$the problem reduce to max s=s1+s2+s3
$$s_{total}=s1+s2+s3=s1=\frac{1}{2}d\sqrt{5^2-(\frac{d}{2})^2}+2*\frac{1}{2}\frac{d-5}{2}\sqrt{4^2-(\frac{d-5}{2})^2}+ 5*\sqrt{4^2-(\frac{d-5}{2})^2}$$
