\r\n" );
document.write( "\r\n" );
document.write( "Here is the step-by-step solution using the standard simplex method:\r\n" );
document.write( "\r\n" );
document.write( "Suppose they will buy w wigs, c candles, and h hats, for a maximum profit P.\r\n" );
document.write( "[I used \"hats\" instead of \"hat clips\" for convenience]\r\n" );
document.write( "\r\n" );
document.write( " |wigs |candles| hats|\r\n" );
document.write( "------------------------------|-----|-------|-----|------------\r\n" );
document.write( "How many bought and sold | w | c | h |\r\n" );
document.write( "Cost each | 10 | 4 | 10 |\r\n" );
document.write( "Cost for all bought & sold. |$10w | $4c |$10h | ≤ $4000 <--cost \r\n" );
document.write( "Selling price for each |$30 |$12 |$24 | \r\n" );
document.write( "Total money taken in |$30w |$12c |$24h | \r\n" );
document.write( "Profit for all bought & sold |$20w | $8c |$14h | = P <--profit\r\n" );
document.write( "Sq. in. required | 10w | 6c | 2h | ≤ 1800 <--sq. in. \r\n" );
document.write( "\r\n" );
document.write( "So the problem is:\r\n" );
document.write( "\r\n" );
document.write( "Maximize P = 20w+8c+14h <--objective function\r\n" );
document.write( "\r\n" );
document.write( "subject to the constraints:\r\n" );
document.write( " 10w + 4c + 10h ≤ 4000\r\n" );
document.write( " 10w + 6c + 2h ≤ 1800\r\n" );
document.write( "w ≥ 0, c ≥ 0, h ≥ 0\r\n" );
document.write( "\r\n" );
document.write( "Rewrite the objective function as\r\n" );
document.write( "\r\n" );
document.write( "-20w - 8c - 14h + P = 0\r\n" );
document.write( "\r\n" );
document.write( "Introduce slack variables s1 and s2 to change the inequalities \r\n" );
document.write( "into equations, and put the rewritten objective function at \r\n" );
document.write( "the bottom:\r\n" );
document.write( "\r\n" );
document.write( "
\r\n" );
document.write( "\r\n" );
document.write( "Next, we put the above system in a special 3x7 partitioned \r\n" );
document.write( "matrix called a \"tableau\", with each variable written \r\n" );
document.write( "above its column of coefficients. The constants in the\r\n" );
document.write( "right-most column are headed k:\r\n" );
document.write( "\r\n" );
document.write( "| w c h |s1 s2 | P | k |\r\n" );
document.write( "------------------------------- \r\n" );
document.write( "| 10 4 10 | 1 0 | 0 | 4000 |\r\n" );
document.write( "| 10 6 2 | 0 1 | 0 | 1800 |\r\n" );
document.write( "-------------------------------\r\n" );
document.write( "|-20 -8 -14 | 0 0 | 1 | 0 |\r\n" );
document.write( "\r\n" );
document.write( "We find the most negative number ('indicator') on the \r\n" );
document.write( "bottom row, which is -20. Its column, the 1st column,\r\n" );
document.write( "is the \"pivot\" column.\r\n" );
document.write( "We divide each POSITIVE number in the k-column by the\r\n" );
document.write( "POSITIVE number in the pivot column which is in the \r\n" );
document.write( "same row. That is:\r\n" );
document.write( "4000/10=400, 1800/10=180\r\n" );
document.write( "Since 180 is smaller, the pivot row is the 2nd row.\r\n" );
document.write( "The pivot element is the 10 in the 2nd row. \r\n" );
document.write( "We use row operations to make the pivot element become\r\n" );
document.write( "1 and all the other elements in the pivot column become 0.\r\n" );
document.write( "Here are three row operations we perform on the above\r\n" );
document.write( "tableau matrix:\r\n" );
document.write( "\r\n" );
document.write( "(1/10)R2 -> R2\r\n" );
document.write( "-10R2+R1 -> R1\r\n" );
document.write( "20R2+R3 -> R3\r\n" );
document.write( "\r\n" );
document.write( "| w c h |s1 s2 | P | k |\r\n" );
document.write( "------------------------------- \r\n" );
document.write( "| 0 -2 8 | 1 -1 | 0 | 2200 |\r\n" );
document.write( "| 1 .6 .2 | 0 .1 | 0 | 180 |\r\n" );
document.write( "-------------------------------\r\n" );
document.write( "| 0 4 -10 | 0 2 | 1 | 3600 |\r\n" );
document.write( "\r\n" );
document.write( "We still have a negative number on the bottom row, -10.\r\n" );
document.write( "Now we find the most negative number ('indicator') on the \r\n" );
document.write( "bottom row. It happens to be the ONLY negative number on\r\n" );
document.write( "the bottom row. which is -10. Its column, the 3rd column,\r\n" );
document.write( "is the \"pivot\" column.\r\n" );
document.write( "We divide each POSITIVE number in the k-column by each\r\n" );
document.write( "POSITIVE number in the pivot column which is in the \r\n" );
document.write( "same row:\r\n" );
document.write( "2200/8=400, 180/.2=1800\r\n" );
document.write( "Since 400 is smaller, the pivot row is the 1st row.\r\n" );
document.write( "The pivot element is the 8 in the 1st row. \r\n" );
document.write( "We use row operations to make the pivot element become\r\n" );
document.write( "1 and all the other elements in the pivot column become 0.\r\n" );
document.write( "Here are the row operations we perform on the above:\r\n" );
document.write( "\r\n" );
document.write( "(1/8)R1 -> R1\r\n" );
document.write( "-.2R1+R2 -> R2\r\n" );
document.write( "10R1+R3 -> R3\r\n" );
document.write( " \r\n" );
document.write( "| w c h | s1 s2 | P | k |\r\n" );
document.write( "---------------------------------------- \r\n" );
document.write( "| 0 -.25 1 | .125 -.125 | 0 | 275 |\r\n" );
document.write( "| 1 .65 0 |-.025 .125 | 0 | 125 |\r\n" );
document.write( "----------------------------------------\r\n" );
document.write( "| 0 1.5 0 | 1.25 .75 | 1 | 6350 |\r\n" );
document.write( "\r\n" );
document.write( "This tableau is finished because there are\r\n" );
document.write( "no more negative numbers (indicators) on \r\n" );
document.write( "the bottom row.\r\n" );
document.write( "\r\n" );
document.write( "We transform the tableau matrix back into\r\n" );
document.write( "a system of equations:\r\n" );
document.write( "\r\n" );
document.write( "
\r\n" );
document.write( " \r\n" );
document.write( "That simplifies to:\r\n" );
document.write( "\r\n" );
document.write( "
\r\n" );
document.write( "\r\n" );
document.write( "Solve the bottom equation for P\r\n" );
document.write( "\r\n" );
document.write( "
\r\n" );
document.write( " \r\n" );
document.write( "
\r\n" );
document.write( "\r\n" );
document.write( "Since c, s1 and s2 cannot be negative, we see that\r\n" );
document.write( "the largest value P can take on is P = 6350 when \r\n" );
document.write( "c = s1 = s2 = 0. So they will not buy any candles!!\r\n" );
document.write( "\r\n" );
document.write( "So we substitute in the other two equations to find\r\n" );
document.write( "the number of wigs and hats:\r\n" );
document.write( "\r\n" );
document.write( "
\r\n" );
document.write( "\r\n" );
document.write( "h = 275, w = 125\r\n" );
document.write( "\r\n" );
document.write( "So the most lucrative plan is to buy \r\n" );
document.write( "\r\n" );
document.write( "125 wigs, 0 candles, and 275 hats. and the maximum profit P = $6350 \r\n" );
document.write( "