\r\n" );
document.write( "It is always either possible to enclose a triangle in a rectangle\r\n" );
document.write( "with sides parallel to the x and y axes such that either \r\n" );
document.write( "\r\n" );
document.write( "1. one vertex of the triangle coincides with a vertex of the rectangle\r\n" );
document.write( "and the other two vertices are on sides of the triangle, as in the figure on the left, or\r\n" );
document.write( "\r\n" );
document.write( "2. two vertices of the triangle coincide with two vertices of the rectangle,\r\n" );
document.write( "as the figure on the right.\r\n" );
document.write( "\r\n" );
document.write( "
\r\n" );
document.write( "\r\n" );
document.write( "For the figure on the left, we will label the coordinates of the\r\n" );
document.write( "vertices of the other thre vertices of the rectangle:\r\n" );
document.write( "\r\n" );
document.write( "
\r\n" );
document.write( "\r\n" );
document.write( "Rectangle FDCE = Triangle AFB + BDC + ACE + ABC\r\n" );
document.write( "\r\n" );
document.write( "DC×CE =
AF×FB +
CD×BD +
AE×CE + X\r\n" );
document.write( "\r\n" );
document.write( "Multiply through by 2\r\n" );
document.write( "\r\n" );
document.write( "2×DC×CE = AF×FB + CD×BD + AE×CE + 2X\r\n" );
document.write( "\r\n" );
document.write( "2(t-p)(s-u) = (r-p)(s-q) + (t-p)(q-u) + (t-r)(s-u) + 2X\r\n" );
document.write( "\r\n" );
document.write( "2ts-2tu-2ps+2pu = rs-rq-ps+pq + tq-tu-pq+pu + ts-tu-rs+ru + 2X\r\n" );
document.write( "\r\n" );
document.write( "2ts-2tu-2ps+2pu-rs+rq+ps-pq-tq+tu+pq-pu-ts+tu+rs-ru = 2X\r\n" );
document.write( "\r\n" );
document.write( " ts - ps + pu + rq - tq - ru = 2X\r\n" );
document.write( "\r\n" );
document.write( "-ru + st + pu - tq - ps + rq = 2X\r\n" );
document.write( "\r\n" );
document.write( "Multiply both sides by -1\r\n" );
document.write( "\r\n" );
document.write( " ru - st - pu + tq + ps - rq = -2X\r\n" );
document.write( "\r\n" );
document.write( "The left side is a 3×3 determinant expanded by the 3rd column:\r\n" );
document.write( "\r\n" );
document.write( "
= -2A\r\n" );
document.write( "\r\n" );
document.write( "Multiplying both sides by
and taking absolute values:\r\n" );
document.write( "\r\n" );
document.write( "A =
\r\n" );
document.write( " \r\n" );
document.write( "In case one of the sides is horizontal or vertical, it just\r\n" );
document.write( "amounsts to one of the triangles degenerating into a line\r\n" );
document.write( "segment with 0 area.\r\n" );
document.write( "\r\n" );
document.write( "----------------------------\r\n" );
document.write( "\r\n" );
document.write( "For the other case you must include an additional rectangle, as\r\n" );
document.write( "shown. I'll leave that derivation to you. It's entirely similar:\r\n" );
document.write( "\r\n" );
document.write( "
\r\n" );
document.write( "\r\n" );
document.write( "Edwin
\n" );
document.write( "