Check the picture below.
when running a line, in a right-triangle, from the 90° angle perpendicular to its opposite side, we will end up with three similar triangles, one Small, one Medium and a containing Large one. So let's use proportions to get x,y and z.