What This Calculator Does
This tool finds the unknown length and width of a rectangle when you only know its area (A) and perimeter (P). While many rectangle calculators ask you for the sides, this one works the other way around — recovering the side lengths from the two most commonly measured global properties. It also returns the diagonal as a bonus.
How to Use It
Enter the area and perimeter in any consistent units (for example, square metres for area and metres for perimeter). Press calculate and the tool returns the longer side as the length, the shorter side as the width, and the diagonal. If no real rectangle can have both values, the calculator tells you so.
The Formula Explained
For a rectangle with length l and width w, area is \(A = l \cdot w\) and perimeter is \(P = 2(l + w)\). From the perimeter, \(l + w = P/2\). The length and width are therefore the two roots of the quadratic \(x^{2} - (P/2)x + A = 0\). Solving gives:
$$w = \frac{P/2 - \sqrt{(P/2)^{2} - 4A}}{2} \quad \text{and} \quad l = \frac{P/2 + \sqrt{(P/2)^{2} - 4A}}{2}.$$
A real solution exists only when the discriminant \((P/2)^{2} - 4A\) is non-negative. When it equals zero, the rectangle is a square.
Worked Example
Suppose \(A = 12\) and \(P = 14\). Then \(P/2 = 7\) and the discriminant is $$7^{2} - 4 \cdot 12 = 49 - 48 = 1,$$ so \(\sqrt{1} = 1\). Width \(= (7 - 1)/2 = 3\) and length \(= (7 + 1)/2 = 4\). The diagonal is $$\sqrt{4^{2} + 3^{2}} = \sqrt{25} = 5.$$ So the rectangle is \(4 \times 3\) with a diagonal of \(5\).
FAQ
Why do I get "no real rectangle"? The values you entered cannot describe an actual rectangle. For a fixed perimeter there is a maximum possible area (a square), so if your area exceeds \((P/4)^{2}\) no real sides exist.
Which side is the length? By convention the larger root is reported as the length and the smaller as the width.
Can it handle a square? Yes — when the discriminant is zero, length equals width and you get a square.