The diagonals of a rectangle bisect one another, so first we find the midpoint M of diagonal AC, which is the average of the endpoints: ((0+12)/2,(2+14)/2)=M(6,8). Since diagonal BD passes through M and is parallel to the x-axis, it must have a y coord of 8 (not 6), since the horizontal line has the equation y=8.

We have the centre of a circle M and radius MC=MA so we can draw a circle passing through A and C, with AC (or BD) as diameter. Any point P on the circumference forms a right angle APC, so the positions of B and D are determined by the intersection of y=8 with the circle.

Using Pythagoras’ Theorem we can work out the radius of the circle=√((8-2)²+(6-0)²)=√72=6√2. The equation of the circle is (x-6)²+(y-8)²=72. When y=8, x-6=±√72, which gives us the x coords of B and D.

B(6-√72,8) and D(6+√72,8)=B(-2.4853,8) and D(14.4853,8).

The gradients of AD (or BC) and CD (or BA) are 6/(6+√72) and 6/(6-√72). These rationalise to √2-1 and -(√2+1) and h=6+√72. So we have the gradients as 6/h and -h/6.