Understanding the rectangle and square calculator — concept and principle
A rectangle is a four-sided shape with four right angles; a square is the special rectangle whose four sides are equal. From the length and width this calculator gives the area, the perimeter and the diagonal. These are among the most used measurements in daily life: floor area for flooring or rent, wall area for paint or wallpaper, fence or skirting-board length, and the diagonal size of a screen, a door frame or a box.
How it is calculated
- Area: A = a × b
- Perimeter: P = 2(a + b)
- Diagonal: d = √(a² + b²)
For a square, set a = b, so A = a², P = 4a and d = a√2. Both inputs must use the same unit. The perimeter and diagonal are in that unit, and the area is in that unit squared (m², cm², ft²).
The principle
Area counts how many unit squares fit inside the shape. A rectangle 8 units long and 5 units wide holds 5 rows of 8 unit squares, so 40 squares in total; the same idea extends to non-whole lengths. The perimeter simply walks around the edge: two lengths and two widths. The diagonal cuts the rectangle into two right triangles whose legs are the length and the width, so by the Pythagorean theorem its square equals a² + b². This is also the practical test for squareness on a building site: if both diagonals of a frame are equal, its corners are right angles.
Worked example
- Inputs: length a = 8, width b = 5.
- Area: 8 × 5 = 40.
- Perimeter: 2 × (8 + 5) = 2 × 13 = 26.
- Diagonal: √(64 + 25) = √89 ≈ 9.433981132.
| Length | Area |
|---|---|
| 2 | 10 |
| 4 | 20 |
| 6 | 30 |
| 8 | 40 |
| 10 | 50 |
| 12 | 60 |
| 16 | 80 |
How to read the result
For a fixed perimeter, the square gives the largest area. A 26-unit perimeter could enclose 6.5 × 6.5 = 42.25 square units instead of 40, while a long thin 12 × 1 rectangle encloses only 12. When ordering materials, area tells you how much flooring, paint or turf to buy, and perimeter tells you how much edging, trim or fencing you need. Most suppliers recommend adding a waste allowance for cuts.
Common mistakes
- Mixing units, such as metres for length and centimetres for width.
- Converting area with the linear factor: 1 m² is 10,000 cm², not 100 cm².
- Using the area when the perimeter is needed (fencing) or the reverse (tiles).
- Forgetting that screen sizes are quoted by the diagonal, not by width.
Frequently asked questions
How do I find the width from the area and the length?
Divide: b = A ÷ a. An area of 40 with length 8 gives width 5.
How do I find the side of a square from its diagonal?
s = d ÷ √2. A diagonal of 10 gives a side of about 7.071.
Why do A-series paper sizes keep the same shape when halved?
ISO 216 uses a length-to-width ratio of √2 : 1, so cutting a sheet in half across its long side gives the same proportions.
Sources: Euclid, Elements, Book I, Proposition 47 (Pythagorean theorem) · ISO 216, Writing paper and certain classes of printed matter — Trimmed sizes — A and B series