The Classic Truncated Triangular Room Problem

Return to the Main Math 293 page Revised July 5, 2012
Some images on this page have been generated via AsciiMathML.js.
For more information see: www.chapman.edu/~jipsen/asciimath.html.

This page walks through solving the cutoff section version of the classic truncated triangular room problem, stated in general terms. The problem is to find the dimensions and size of the largest rectangular box that can be constructed in a truncated triangular room of given dimensions, but where that room has a third "wall" along the hypotenuse of the floor of the room. Such a triangular room still has a right triangle for its floor. Its three walls are trapezoids. The roof is still a triangle. An image of such a room, placed at the origin of a rectangular coordinate system is:

We will solve this problem using the method of Legrange multipliers.

We start with the volume of the box:
`V(x,y,z) = x**y**z` (1)
Then we have to find the equations of the two planes that make up the roof and the third wall. To find the equation of the plane of the roof we can construct the vectors from point D to C, and from D to E.

`bb(vec (DC)) = (:-a,0,c-d:)` and `bb(vec (DE)) = (:-a,b,e-d:)`
Then we find the cross product of the two vectors
`bb(vec (DC)) xx bb(vec (DE)) = (: - b(c-d), - [- a(e-d)- - a(c-d)], - ab :)`

`bb(vec (DC)) xx bb(vec (DE)) = (: bd-bc, ae-ac, - ab :)`

Therefore, we have the coefficients for the equation of the plane and we are just missing the constant, as in:
`( bd-bc ) x + ( ae-ac ) y + ( - ab )z = bbL`
However, if we substitue the point (a,0,d), which we know to be on the plane we get:
`( bd-bc ) a + ( ae-ac ) 0 + ( - ab )d = bbL`

` abd - abc - abd = bbL`

` -abc = bbL `

so

`( bd-bc ) x + ( ae-ac ) y + ( - ab )z = -abc`

or

`( bc-bd ) x + ( ac-ae ) y + ( ab )z = abc`

We restate this as the function `g(x,y,z)` as
`g(x,y,z) = ( bc-bd ) x + ( ac-ae ) y + ( ab )z - abc` (2)
Then, we can do the same thing for `vec(AD) xx vec(AB)`, namely
`(:0,0,d:) xx (: -a,b,0:) = -bd i + -ad j + 0k`
Therefore, the plane has the equation
`-bd x + -ad y + 0z = bbM`
and we can evaluate this at a point on the plane, namely at (a,0,0) to get
`-bd a + -ad**0 + 0**0 = bbM`

so

`-abd = bbM`

and the equation becomes
`-bd x + -ad y + 0z = -abd`

or

`bd x + ad y = adb `

We restate this as the function `h(x,y,z)` as
`h(x,y,z) = bd x + ad y - adb ` (3)

At this point we have the three functions V, g, and h, where we are looking to maximize V subject to the constraints of g and h. The Legrange method looks at having `lambda` and `mu` where
`gradV(x_0,y_0,z_0) = lambda * gradg(x_0,y_0,z_0) + mu*gradh(x_0,y_0,z_0)` (4)
at the solution point `(x_0,y_0,z_0)`. We will form each of these gradients.

`gradV(x,y,z) = yz vec(i) + xz vec(j) +xy vec(k)`

`gradg(x,y,z) = (bc-bd) vec(i) + (ac-ae) vec(j) + ab vec(k)`

`gradh(x,y,z) = bd vec(i) + ad vec(j) + 0 vec(k)`

Then, based upon (4) we will have to have each of the following three equations be true:
`yz = lambda(bc-bd) + mu(bd)` (5)
`xz = lambda(ac-ae) + mu(ad)` (6)
`xy = lambda(ab)` (7)
and we combine these with the equations for the planes involved:
`( bc-bd ) x + ( ac-ae ) y + ( ab )z = abc` (8)
`bd x + ad y = adb ` (9)
The five equations, (5) - (9) form a system that we can now solve.

Multiply (5) by `a` and multiply (7) by `(c-d)` to get

`ayz = lambda(ab(c-d)) + mu(abd)`
and
`(c-d)xy = lambda(ab(c-d))`
Subtract the second from the first to get `ayz - (c-d)xy = abd mu`
`ayz - (c-d)xy = abd mu` (10)
Then, if we multiply (6) by `b` and (7) by `(c-e)` to get
`bxz = lambda(ab(c-e)) + mu(abd)`
and
`(c-e)xy = lambda(ab(c-e))`
Subtract the second from the first to get `bxz - (c-e)xy = abd mu`
`bxz - (c-e)xy = abd mu` (11)
From (10) and (11) we can equate the left sides to get
`ayz -cxy +dxy = bxz - cxy + exy`
or
`0 = bxz + (e-d)xy -ayz` (12)
Return to (9) and solve for `y`, noting at this point that our analysis requires that `d!=0` [Had we used the point (0,b,e) to generate the second plane we would have seen a similar requirement for `e`, namely, `e!=0`]
`ad y = abd - bd x`

`y = (-bd x)/(ad) + (abd)/(ad)`

`y = (-b)/a x + b` (13)
Now return to (8), substituting for y using (13), and solve for `z`:
`(bc - bd) x + (ac -ae)( (-b)/a x + b) + abz = abc `

`(bc - bd) x + -bcx + bex + abc - abe + abz = abc`

`bcx - bdx - bcx + bex + abz = abe`

`b(e - d) x + abz = abe`

`abz = b(d - e) x + abe`

`z = (d-e)/a x + e` (14)
Take the results in (13) and (14) and apply them to equation (12)
`0 = bx( (d-e)/a x + e) + (e-d)x( (-b)/a x + b) - a ( (-b)/a x + b)( (d-e)/a x + e)`
multiply both sides by `a`
`0 = bx((d-e)x + ae) + (e-d)x(-b x + ab) - (-b x +ab)( (d-e) x + ae )`

`0 = bd x^2 - bex^2 + abex + (e - d) x (-bx) + (e - d) x (ab) - (-bx+ab)(dx -ex + ae)`

`0 = bdx^2 - bex^2 + abex + -bex^2 +bdx^2 + abex - abd x + bdx^2 - abdx - bex^2 + abex + abex - a^2be`

`0 = 3bdx^2 -3bex^2 + 4abex - 2abdx -a^2be`

`0 = 3b(e - d)x^2 -2ab(2e-d)x + a^2be`

`0 = 3(e - d)x^2 -2a(2e-d)x + a^2e`

This, of course, is a quadratic equation, as long as `d!=e`. Therefore, to move forward we will make that assumption. Then, the value of `x` is:
`x = (4ae - 2ad +- sqrt( (-4ae - 2ad)^2 - 4*3(e - d)*a^2e) )/(2*3(e - d)`
`x = (4ae - 2ad +- sqrt( 4a^2d^2 - 16a^2ed + 16a^2e^2 - 12a^2e^2 + 12a^ed) )/(6(e - d)`
`x = (4ae -2ad +- sqrt(4a^2d^2 - 4a^2ed + 4a^2e^2) )/ (6(e - d)`
`x = (4ae - 2ad +- 2a*sqrt(d^2 -ed + e^2) )/( 6(e - d))`
`x = (2ae -ad +- a sqrt(d^2 - de + e^2) )/(3(e - d))` (15)
Only one of the values, in any particular case, will be reasonable. However, for the purposes here we will continue to use the `+-` in the value of `x`.

Substituting this value of `x` in (14) gives:

`z = (d - e)/a * (2ae -ad +- a sqrt(d^2 - de + e^2) )/(3(e - d)) + e`
`z = ( (2e - d +- sqrt(d^2 - de + e^2) )/(-3) ) + (-3e)/(-3)`
`z = ( -e - d +- sqrt(d^2 - de + e^2)) / (-3)`
`z = (d + e +- sqrt(d^2 - de + e^2) )/3` (16)
Again, giving two answers, only one of which will correspond to the particular value of `x` from (15).

Substituting (15) into (13) gives:

`y =( (-b)/a) * (2ae -ad +- a sqrt(d^2 - de + e^2) )/(3(e - d)) + b`
`y = (-2be + bd +- b sqrt(d^2- de + e^2))/(3(e - d)) + (b * 3(e - d))/(3(e - d))`
`y = (-2be + bd +- b sqrt(d^2- de + e^2))/(3(e - d)) + (3be - 3bd)/(3(e - d))`
`y = (-2bd + be +- b sqrt(d^2 - de + e^2))/(3(e - d))`
`y = (be - 2bd +- b sqrt(d^2 - de + e^2) )/(3(e - d))` (17)

Thus we have equations (15), (16), and (17) that allow us to determine the values of `x`, `y`, and `z` from the values of a, b, c, d, and e in the original problem. In a real problem it would be easier to find the value of `x` from (15) and then use that value along with (13) and (14) to find the values of `y` and `z`. Once we have all three values, the value of the volume is just `x*y*z`.

As a small example, consider the room formed by A=(7,0,0), B=(0,4,0), C=(0,0,8), D=(7,0,3), and E=(0,4,5). Using the nomenclature from the diagram at the start of this page, this give a=7, b=4, c=8, d=3, and e=5. From this and using (15) we get `x=(49+-7sqrt(19))/6` or `x~~13.25204877` or `x~~3.081284566`. Of these, clearly the first is not feasible so the second is the only answer. Then using (13) and (14), we get `y~~2.23926312` and `z~~4.11963156` so the volume is approximately `28.42474401`.

Looking at the following table of volumes, based upon values for `x` and `y`, and recognizing that these are values at specific points in the domain, and that values are rounded to 5 decimal places, we have even more confidence in our results:

 
x:
y     
3.08113.08123.08133.08143.0815
2.239028.4219228.4223428.4227728.423228.42363
2.239128.4226728.423128.4235328.4239628.42439
2.239228.4234228.4238528.4242800
2.239328.4241728.4246000
2.239400000

Unfortunately, there is a major problem with our solution. This is illustrated by another specific example, namely, A=(19,0,0), B=(0,18,0), C=(0,0,20), D=(19,0,1), and E=(0,18,2). Using the nomenclature from the diagram at the start of this page, this give a=19, b=18, c=20, d=1, and e=2. From this and using (15) we get `x=(57+-3sqrt(3))/3` or `x~~29.96965511` or `x~~8.030344885`. Of these, clearly the first is not feasible so the second is the only answer. Then using (13) and (14), we get `y~~10.39230485` and `z~~1.577350269` so the volume is approximately `131.6358614`. However, looking at the following table of volumes, based on values for `x` and `y` we can see a major problem.

 
x:
y     
8.02908.02958.03008.03058.0310
10.3880132.03051131.99703131.96354131.93005131.89655
10.3885131.99516131.96168131.92818131.89469131.86118
10.3890131.95981131.92632131.89282131.85932131.82581
10.3895131.92445131.89096131.85746131.82395131.79044
10.3900131.88909131.85559131.82209131.78858131.75506
10.3905131.85373131.82022131.78671131.7532131.71968
10.3910131.81836131.78485131.75133131.71781131.68429
10.3915131.78298131.74947131.71595131.68243131.6489
10.3920131.7476131.71409131.68057131.647040
10.3925131.71222131.6787131.6451800
10.3930131.67684131.64331000
10.3935131.641450000
10.394000000
It would appear that the volume we calculated may well be the maximum volume along the line from (19,0,1) to (0,18,2), and it is [remember that the points in the table are close to but not necessarily on the line from (19,0,0) to (0,18,0)]. The big problem is that there are many other values on the table that are larger than our calculated maximum. The reason for this is that the second constrain, in this case the "wall" containing (19,0,0), (0,18,0), (0,18,2), and (19,0,1), is "outside of the maximum value at (20/3,20/3,20/3). In particular, had the wall not been there, then the problem would have had the roof hitting the floor at (20,0,0) and (0,20,0). We know from our earlier work that the maximum volume rectangular box that could be constructed in this "room" would have dimensions 1/3 the length, width, and height of the room. Since our second constraint is outside of that region it really has no effect on the outcome. Below is a table giving the volumes for points around the 1/3 mark.
 
x:
y     
6.506.556.606.656.706.756.80
6.5295.7500295.8963296.0100296.0913296.1400296.1563296.1400
6.55295.8963296.0273296.1255296.1910296.2238296.2238296.1910
6.60296.0100296.1255296.2080296.2575296.2740296.2575296.2080
6.65296.0913296.1910296.2575296.2908296.2908296.2575296.1910
6.70296.1400296.2238296.2740296.2908296.2740296.2238296.1400
6.75296.1563296.2238296.2575296.2575296.2238296.1563296.0550
6.80296.1400296.1910296.2080296.1910296.1400296.0550295.9360

All of which goes to show that one cannot just apply rules and formuli.

©Roger M. Palay
Saline, MI 48176
July, 2012