Ladders

Are ladders too simple for math questions? These brain teasers might drive you up the wall.

Building a Ladder

A ladder of length l = 84 inches is to be built with rungs spaced equally, about 5 inches apart. The same spacing is used at the ends, as well. How do you figure out the exact spacing? In the picture adding one more rung on the right would make the last space too small.

BuildLadder[84, 5];

Answer

The number of spaces needs to be a whole number.

This is the number of spaces.

Round[84/5]

This is the exact length of a space.

N[84/17]

Now the rungs of the  ladder are properly spaced.

BuildLadder[84, %];

A Sliding Ladder

The lines in the next graph represent the positions of a ladder with the top sliding down a wall as the bottom slides along the ground. Why do all of these segments have the same length? 
The horizontal distance from the foot of the ladder to the wall is x, and the vertical distance from the ground to the top of the ladder is y.

y = Sqrt[1 - a^2] (1 - x/a);

Plot[ Evaluate[Table[y, {a, .09, .99, .05}]], 
	{x, 0, 1}, 
	AspectRatio -> Automatic, 
	PlotRange -> {{0, 1}, {0, 1}}
];

Answer

xIntercept = a;

yIntercept = Sqrt[1 - a^2];

Use Pythagoras' formula to find the length of the line between the intercepts. The length is always the same.

Sqrt[xIntercept^2 + yIntercept^2]

The Astroid

The curve formed by the lines is part of a curve called an astroid. (It is not a parabola.) This is the full astroid. In Latin "aster" means star, which is what the Romans must have thought the curve looked like.

ParametricPlot[
	{Cos[t]^3, Sin[t]^3}, {t, 0, 2 Pi}, 
	AspectRatio -> Automatic];

The Atroid as an Envelope

The next two command will generate the frames of an animation showing a line segment of length 1 sweeping out an astroid.

AstroidSweep[4];

Carrying a Ladder

Two corridors meet to form an L shape. The corridor going in the north-south direction is 2 meters wide, 12 meters long and the one going in the east-west direction is 4 meters wide, 20 meters long. 

What is the longest ladder that can be carried horizontally around the corner?

NSw = 2;	(* north-south corridor width *)
NSl = 12;	(* north-south corridor length *)
EWw = 4;	(* east-west corridor width *)
EWl = 20; 	(* east-west corridor length *)

Corridor[ Range[-6, -1, .25] ];

Hints

Set up a coordinate system with the origin at the point marked O. 
The longest ladder that can get around will be the shortest line that touches the inside corner.

Answer

The equation of the line depends on where it starts at the left wall, which is the y-intercept of the ladder line. Call it y0. Then the ladder line passes through the point{0, y0} on the right wall as well as the point {NSw, 0}, the inside corner.

Clear[y];

ladderline = (y - y0) == (0 - y0) / (NSw - 0) (x - 0)

At the other end the ladder line meets the line BC.

topend = 
	{x, y} /. Solve[{ladderline, y == 4}, {x, y}] [[1]]

To find the length of the ladder line use Pythagoras.

diff = topend - {0, y0}

length = Sqrt[diff . diff]

Before minimizing this expression with FindMinimum, plot the function. There are two minima, one when y0 is positive and the other when y0 is negative. We want the larger of the two, which is when y0 is negative.

Plot[length, {y0, -7, 7}];

FindMinimum[length, {y0, 1}]

For this y0 the length is exactly 0. Such a short ladder is uninteresting.

length /. y0 -> 4

{minimum, minrule} = FindMinimum[length, {y0, -1}]

This shows the longest ladder that can make it around the corner.

Corridor[ y0 /. minrule];

This shows an animation of the ladder going around the corner. Describe the path of the forward end of the ladder.

Map[Show, CorridorSweep[y0 /. minrule, minimum, 5]];

Leaning a Ladder (incomplete)

A shed 15 feet wide and 10 feet high is in front of a wall. How far up the wall can a 20-foot ladder reach?

p = ParametricPlot[
	Evaluate @ Table[
		b {Cos[t]^3, Sin[t]^3}, 
		{b, 0, 1, .1}], {
	t, 0, Pi/2}, 
	AspectRatio -> Automatic,
	DisplayFunction -> Identity];
Show[{
	Graphics @ {RGBColor[0,1,0], 
		Polygon[.02 {{0,0}, {15,0}, {15,10}, {0,10}}]}, 
		p}, 
	DisplayFunction -> $DisplayFunction];

Implementation

BuildLadder

BuildLadder[length_, space_] := Show[Graphics[
	{
		RGBColor[0, 0, 1], Thickness[.02], 
		Line[{{0, -5}, {length, -5}}], 
		Line[{{0, 5}, {length, 5}}], 
		Table[Line[{{x, -5}, {x, 5}}], 
		{x, space, length - space, space}]
	}, 
	AspectRatio -> Automatic
]];

AstroidSweepAux, AstroidSweep

AstroidSweepAux[p_, T_, e_] :=
Module[
(* e is plus or minus 1 to go around the top or bottom. *)
{a}, 
Table[
		Show[
			{
			p, 
			Graphics[{
				RGBColor[0,0,1], 
					Line[{{a, 0}, {0, e Sqrt[1 - a^2]}}], 
				PointSize[.015], RGBColor[1,0,0],
				Point[{a, 0}], Point[{0, e Sqrt[1 - a^2]}]
			}] 
			}, 
			DisplayFunction -> $DisplayFunction], 
	{a, -e 1, e -e 1/T, e 1/T}
	]
]

AstroidSweep[T_] := Module[
{p}, 
p = ParametricPlot[
	{Cos[t]^3, Sin[t]^3}, {t, 0, 2 Pi}, 
	AspectRatio -> Automatic,
	PlotRange -> {{-1,1}, {-1,1}}, 
	Ticks -> None, 
	AxesStyle -> {Dashing[{.01,.05}], Dashing[{.01,.05}]},
	DisplayFunction -> Identity];	
	Join[
		AstroidSweepAux[p, T, 1], 
		AstroidSweepAux[p, T, -1]
	]
]

LadderLineLoose, EmptyCorridor, Corridor, LadderLineFixed, CorridorSweep

LadderLineLoose[y0_?Negative] := 
	Line[{{0, y0}, {NSw (1 - EWw / y0), EWw}}]

LadderLineLoose[y0_List] := Map[LadderLineLoose,  y0]

EmptyCorridor[] := Module[
{a,b,c,d,e,f, Lshape, sides, labels},
	a = {0, EWw - NSl};
	b = {0, EWw};
	c = {EWl, EWw};
	d = {EWl, 0};
	e = {NSw, 0};
	f = {NSw, EWw - NSl};
	Lshape = {RGBColor[0,1,0], Polygon[{a,b,c,d,e,f}]}; 
	sides = {RGBColor[0,0,1], Line[{a,b,c}], Line[{d,e,f}]};
	labels = {RGBColor[0,0,0], 
		Thread[
			Text[{"O","A","B","C","D","E","F"}, 
			{{-.5, 0}, a + {-.5, -.5}, b + {-.5, .5}, 
			c + {.5, .5}, d + {.5, -.5}, e + {.5, -.5}, 
			f + {.5, -.5}}]
		]};
	{labels, Lshape, sides, RGBColor[1,0,0]}
]

Corridor[y0_] := Module[
	{n0}, 
	(* The next line makes sure only negative values 
		are sent to LadderLine. *)
	n0 = If[ListQ[y0], Select[y0, Negative], y0];
	Show[
		Graphics @ RotateLeft @ 
			Join[EmptyCorridor[], {LadderLineLoose[n0]}],
		AspectRatio -> Automatic, 
		PlotRange -> All
	]]

In the animation program CorridorSweep, the ladder of maximum length will be slid with one end on the left wall of the north-south corridor so that it touches the inside corner. This calculates the point {x, y} at the other end of the ladder. It is used in the function LadderLineFixed. We use NSW instead of NSw to see it symbolically rather than with its given value.

Simplify @ First @ MapAll[
	Expand, 
	Solve[
		{length^2 == x^2 + (y - y0)^2,
		length == Sqrt[(x - NSW)^2 + y^2] + 
			Sqrt[NSW^2 +y0^2]},
	 {x,y}]
]

LadderLineFixed[y0_, length_] := Module[
	{a}, 
	a = length / Sqrt[NSw^2 + y0^2];
	Line[{{0, y0}, {a NSw, y0 (1 - a)}}]
]

CorridorSweep[y0_, length_, T_] := Module[
	{c, y},
	c = EmptyCorridor[]; 
	Table[
		Graphics[
			Join[c, {RGBColor[1,0,0], 
				LadderLineFixed[y, length]}],
			AspectRatio -> Automatic, 
			PlotRange -> All
		],
	{y, 3 y0, 1/3 y0, - 3/2 y0 / T}
	]
]