# Length and Width of Rectangle - Calculator

Online calculator to calculate the dimensions (length and width) of a rectangle given the area A and perimeter P of the rectangle.

## Formula for Area and Perimeter of Rectangle

The formulas for the perimeter P and the area A of the rectangle are used to write equations as follows:

*P = 2 × L + 2 × W*

*A = L × W*

Then these equations are solved for L and W which are the length and width of the rectangle.

## How to use the calculator

Enter the perimeter P and area A as positive real numbers and press "Calculate". The outputs are the width, length and diagonal of the rectangle. There are conditions under which this problem has a solution (see formulation of problem below).

## Formulation of Problem

Let P be the perimeter of a rectangle and A its area. Let W and L be, respectively, the width and length of the rectangle. Find W and L in terms of P and A.

__solution__

P = 2 × W + 2 × L (1)

and

A = W × L (2)

solve equation (1) for W:

W = P / 2 - L

substitute W by P / 2 - L in A = W × L to obtain

A = L × (P / 2 - L)

Rewrite as a standard quadratic equation in L

L ^{ 2} - L (P / 2) + A = 0

Solve the above equation for L and find W using W = P / 2 - L.

Practice: Find the discriminant of the above quadratic equation and find the condition on P and A under which the above problem has no solution.