A 3' cube sits on level ground against a vertical wall. A 12' ladder on the same ground leans against the wall such that it touches the top edge of the box.

How far from the wall must the foot of the ladder be, if it is to reach maximum height whilst meeting the foregoing conditions?

A+

|\

| \

| \

| \

| \

| \

| \

| \ E

C+--------\

| |\

| | \

| | \

| | \

+--------+----+

O D B

The length of the ladder is 12: AB = 12

The edge length of the box is 3: CE = DE = OD = OC = 3

The distance the foot of the ladder is from the wall is OB: OB=x

The distance the top of the ladder is from the ground is OA: OA=y

AC = OA - OC = y-3

BD = OB - OD = x-3

ACE and EDB are similar triangles, so AC/CE = ED/DB: (y-3)/3 = 3/(x-3)

AOB is a right triangle, so AO^2 + BO^2 = AB^2: y^2 + x^2 = 12^2

x and y can be found by solving the system:

Eqn 1: (y-3)/3 = 3/(x-3)

Eqn 2: y^2 + x^2 = 12^2

From Eqn 1: y = 3 + 9/(x-3)

Substitute into eqn 2: (3 + 9/(x-3))^2 + x^2 = 144

9 + 54/(x-3) + 81/(x-3)^2 + x^2 = 144

9(x-3)^2 + 54(x-3) + 81 + x^2*(x-3)^2 - 144(x-3)^2 = 0

x^4 - 6x^3 - 126x^2 + 864x - 1296 = 0

Using a numeric solver gives:

x = 11.2827168988, x = 4.08659997799, x = 2.39022497512, x = -11.7595418519

as roots of the polynomial.

Two roots are in the range [3,12]: x = 11.2827168988, and x = 4.08659997799

If x = 11.2827168988 then y = 3 + 9/(11.2827168988-3) = 4.08659997799

If x = 4.08659997799 then y = 3 + 9/(4.08659997799-3) = 11.2827168988

These two solutions represent the only two positions the ladder can be in to satisfy the physical constraints of the problem. The two solutions are actually reflections of each other over the line x=y.

The problem is looking to achieve the greater height so the solution is

**the foot of the ladder is 4.08659997799 feet from the wall**.