Dimensions of a Rectangle Calculator

Dimensions of a Rectangle Calculator

Leading AI Skill PRO

Enter Calculation

Formula

L,W=s±s2−4Area (A)2where{s=Perimeter (P)2L=s+s2−4A2W=s−s2−4A2\begin{gathered} L,\,W = \frac{s \pm \sqrt{s^{2} - 4\,{{\text{Area }(A)}}}}{2} \\[1.5em] \text{where}\quad \left\{ \begin{aligned} s &= \frac{{{\text{Perimeter }(P)}}}{2} \\ L &= \frac{s + \sqrt{s^{2} - 4A}}{2} \\ W &= \frac{s - \sqrt{s^{2} - 4A}}{2} \end{aligned} \right. \end{gathered}
Show calculation steps (1)
  1. Diagonal of the Rectangle

    d=L2+W2d = \sqrt{L^{2} + W^{2}}

    Once Length (L) and Width (W) are found, the diagonal follows from the Pythagorean theorem.

Usage stats

Advertisement

Results

Length × Width
4 × 3
length × width (same units as input)
Length 4
Width 3
Diagonal 5

Report an error on this page

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.

Rectangle showing length l, width w, and diagonal d
A rectangle is defined by its length, width, and diagonal.

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.

Advertisement
Diagram showing area A and perimeter P as inputs producing length and width
Area and perimeter are combined to solve for the two dimensions.

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\).

Same Perimeter, Different Areas: Scenario Comparison

For a given perimeter \(P\), let \(s = P/2\). The discriminant is \(s^2 - 4A\). Length and width are \(L, W = \frac{s \pm \sqrt{s^2-4A}}{2}\), and the diagonal is \(d=\sqrt{L^2+W^2}\). For a fixed perimeter, the largest possible area is the square's area, \((P/4)^2\). Any area above that value has no real rectangle.

Area (A) Perimeter (P) s = P/2 Discriminant s² − 4A Width (W) Length (L) Diagonal (d) Max area (P/4)²
12 14 7 49 − 48 = 1 3 4 5 (exactly) 12.25
20 18 9 81 − 80 = 1 4 5 ≈ 6.40 (√41) 20.25
16 16 8 64 − 64 = 0 4 4 (square) ≈ 5.66 (√32) 16
30 22 11 121 − 120 = 1 5 6 ≈ 7.81 (√61) 30.25
20 16 8 64 − 80 = −16 No real rectangle (negative discriminant) 16

Worked check for the first row: \(s = 14/2 = 7\), so \(\sqrt{49-48}=1\), \(L=(7+1)/2=4\), \(W=(7-1)/2=3\), and \(d=\sqrt{4^2+3^2}=\sqrt{25}=5\).

In the last row, a perimeter of 16 can enclose at most \((16/4)^2 = 16\) square units. An area of 20 is larger than that, so no rectangle fits. This is the situation the negative discriminant signals.

Advertisement

Key Terms and Variables

  • Area (A): the surface enclosed by the rectangle, \(A = L \times W\). It is measured in square units (cm², m², ft²).
  • Perimeter (P): the total distance around the rectangle, \(P = 2(L+W)\). It is measured in linear units (cm, m, ft).
  • Length (L) and width (W): the two side lengths. By convention \(L \ge W\). They are the two roots of \(x^2 - sx + A = 0\), where \(s = P/2\).
  • Diagonal (d): the segment joining opposite corners, \(d = \sqrt{L^2 + W^2}\) (Pythagorean theorem).
  • Discriminant: \((P/2)^2 - 4A\). If it is positive, there are two distinct side lengths, so the rectangle is not a square. If it is zero, \(L = W\) and the shape is a square. If it is negative, no real rectangle has that area and perimeter.
  • Consistent units: enter area in square units and perimeter in the matching linear units. For example, use m² with m, not m² with cm. Convert first if they differ. The results (length, width, diagonal) come out in the same linear unit as the perimeter.

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.

Last updated:

Most popular in Geometry

View all Geometry calculators