Let
be the dimensions of the rectangle. We know the equations for both area and perimeter:


So, we have the following system:

From the second equation, we can deduce

Plug this in the first equation to get

Refactor as

And solve with the usual quadratic formula to get

Both solutions are feasible, because they're both positive.
If we chose the positive solution, we have

If we choose the negative solution, we have

So, we're just swapping the role of
and
. The two dimensions of the rectangle are
and 