# Finding the other 2 coordinates of a rectangle if you only have 2

Is there a formula/calculation to work out how to find the other $2$ coordinates for a rectangle if you only have the bottom left and top right coordinates?

e.g. My bottom-left coordinate would be $(-1, 0)$ and top right would be $(3, -2)$, I can work out the midpoint but I can't seem to get my head around how to work out the other $2$ coordinates?

-
Have you drawn a picture? – Ragib Zaman Nov 24 '11 at 13:43
I think that solution isn't unique... – pedja Nov 24 '11 at 13:47
@pedja If it is given that the two points given are diagonal such as in the OP's example, then a unique rectangle is determined. – Ragib Zaman Nov 24 '11 at 13:53
Its a formula I need for programming, obviously drawing it out I can work it out but was wondering if the was a general rule of calculation to work it out?! – r0bb077 Nov 24 '11 at 13:59
@RagibZaman,I am not sure about that..draw the circle with radius half of the diagonal and midpoint as center then each point on the circle can be vertice point of the rectangle – pedja Nov 24 '11 at 14:01

Let's observe picture below. Each point $(x,y)$ of the circle that satisfy following equality can be vertice point of the rectangle :

$\left(\sqrt{(x_A-x)^2+(y_A-y)^2}\right)^2 + \left(\sqrt{(x_C-x)^2+(y_C-y)^2}\right)^2=\left(\sqrt{(x_A-x_C)^2+(y_A-y_C)^2}\right)^2$ ,

where $A(-1,0)$ , and $C(3,-2)$ are given vertices.

For example if you choose point $B_1$ you can calculate coordinates of $D_1$ by using equalities :

$x_{D_1}=2x_O-x_{B_1}$ , and $y_{D_1}=2x_O-y_{B_1}$

If you have length of one edge , let's say $|\bar{AB_1}|$ then you can write an extra equality :

$|\bar{AB_1}|= \sqrt{(x_A - x)^2+(y_A-y)^2}$ , and find relation between $x$ and $y$ coordinates.

-
Hey pedja, thanks for the graphics but how would I find out what B1 actually is?! – r0bb077 Nov 24 '11 at 15:07
@robbo77,coordinates of $B_1$ must satisfy square-root equality above... – pedja Nov 24 '11 at 15:12
You can chose $B_1$ freely as any point on the circle. The last corner is that directly opposite it. In Pedja's graphic, $AB_1CD_1$ and $AB_2CD_2$ are two different rectangles that both have AC as diagonal, so you won't get a unique solution without adding more constraints (such as "the edges must be parallel to the coordinate system axes). – Henning Makholm Nov 24 '11 at 15:13
Ahhh, now I've got there!! SO basically I need to know another coordinate or the length of the sides. Thanks guys! – r0bb077 Nov 24 '11 at 15:18
Sorry to be so pre-school but if I did set a length for one of the edges how would I then find the coordinates?! – r0bb077 Nov 24 '11 at 15:25

In your example, the bottom left coordinate is higher up than the top right coordinate.

Suppose that $b<d$ and $a<c$. If the bottom left coordinate is $(a,b)$ and the top right is $(c,d)$, then the top left coordinate would be $(a,d)$ and the bottom right would be $(c,b)$.

Other cases can be worked out similarly.

-
Thanks Joe, just noticed I had my numbers mixed up!! – r0bb077 Nov 24 '11 at 14:36

I agree with top left coordinate would be (a,d) and the bottom right would be (c,b). But, it is taking an assumption that the rectangle is not rotated. If rectangle is rotated wrt to our x,y coordinates then we need to transform our x,y axis.

-