Finding the smallest rectangle able to contain a rectangle with diagonal of length n is the same as asking what the largest area a rectangle with a diagonal of length n can have is (since this rectangle could contain itself, and all others are smaller). Let a and b be the sides of this rectangle. n^2 = a^2 + b^2 (1) The area of this rectangle will then be c = a*b (2) So we are asking what the largest value for c is, for some constant n. From (1), we get a = sqrt(n^2-b^2) thus, c=sqrt(n^2-b^2)b We take the first derivative of this to determine the maximum: c(b)'=(n^2-2b^2)/sqrt(n^2-b^2). Setting to 0, 0 = n^2-2b^2 2b^2=n^2 b=sqrt(n^2/2) (3) Back into (1) gives us: n^2 = a^2 + sqrt((n^2)/2)^2 n^2 = a^2 + (n^2)/2 a^2 = n^2 - (n^2)/2 So a^2 = (n^2)/2, a=sqrt((n^2)/2), and a=b. (This is entirely unsurprising if you play with rectangles in your mind: the biggest area occurs at the square.) Finally, we put a and b back into (2), finding the area of a square with sides of length sqrt(n^2)/2: c = a*b c = sqrt((n^2)/2)^2 c = (n^2)/2