I've modified your diagram a little bit (see attachment)
1. If you put the right bottom corner on the left top corner then there is nothing to minimize.
2. You can prove that the 2 red right triangles are congruent.
3. Thus all lines coloured blue have the same length. In your diagram one of the blue lines was labeled y.
4. You get 2 equations:
 Plug the term for y from  into :