Thursday 6 August 2020

Volume of tetrahedron limited by 4 planes

Consider the following puzzle:
Calculate the volume of a tetrahedron enclosed by the following 4 planes
$$a_1x+b_1y+c_1z+d_1=0\\a_2x+b_2y+c_2z+d_2=0\\a_3x+b_3y+c_3z+d_3=0\\a_4x+b_4y+c_4z+d_4=0$$

The easiest way to calculate this volume is by applying a linear transformation to the tetrahedron where the planes of the tetrahedron align to the coordinate planes. It is impossible to find a purely linear transformation that does this, as all linear transformations project the origin, to the origin, but it is possible to find a linear transformation, followed by a translation, to do this. As translations do not change the volume, this will not pose any unsolvable issues.

An example of such a transformation is

$$u=a_1x+b_1y+c_1z+d_1\\v=a_2x+b_2y+c_2z+d_2\\w=a_3x+b_3y+c_3z+d_3$$

To find the transformation of a given plane, one has to add the equation of the plane to the system of equations of the transformation. For example, for the first plane this becomes:

$$u=a_1x+b_1y+c_1z+d_1\\v=a_2x+b_2y+c_2z+d_2\\w=a_3x+b_3y+c_3z+d_3\\0=a_1x+b_1y+c_1z+d_1$$

Or solved: $u=0$. So the first plane matches the $vw$-plane.

This is analog for the two next planes, but things become interesting for the last plane, where the system becomes:

$$u=a_1x+b_1y+c_1z+d_1\\v=a_2x+b_2y+c_2z+d_2\\w=a_3x+b_3y+c_3z+d_3\\0=a_4x+b_4y+c_4z+d_4$$

Now, in our $uvw$ space, we have a tetrahedron enclosed by the coordinate planes, and a 4th plane that is the solution of the above equation. Tetrahedra enclosed by all 3 coordinate planes have the following vertices: $$(0,0,0), (u,0,0), (0,v,0), (0,0,w)$$ Each of these points can be found by solving the system of equations of 3 of the 4 planes. 

Using the first 3 planes obviously gives (0,0,0) as a solution.

Using all of them except the first gives us:

$$u=a_1x+b_1y+c_1z+d_1\\v=a_2x+b_2y+c_2z+d_2\\w=a_3x+b_3y+c_3z+d_3\\0=a_4x+b_4y+c_4z+d_4\\v=0\\w=0$$

This easily simplifies to 

$$u=a_1x+b_1y+c_1z+d_1\\0=a_2x+b_2y+c_2z+d_2\\0=a_3x+b_3y+c_3z+d_3\\0=a_4x+b_4y+c_4z+d_4$$

If we call:

$$A_1 =\left[ \begin{matrix} a_1&b_1&c_1&1\\a_2&b_2&c_2&0\\a_3&b_3&c_3&0\\a_4&b_4&c_4&0\end{matrix}\right]\\A_2 =\left[ \begin{matrix} a_1&b_1&c_1&0\\a_2&b_2&c_2&1\\a_3&b_3&c_3&0\\a_4&b_4&c_4&0\end{matrix}\right]\\A_3 =\left[ \begin{matrix} a_1&b_1&c_1&0\\a_2&b_2&c_2&0\\a_3&b_3&c_3&1\\a_4&b_4&c_4&0\end{matrix}\right]\\A_4 =\left[ \begin{matrix} a_1&b_1&c_1&0\\a_2&b_2&c_2&0\\a_3&b_3&c_3&0\\a_4&b_4&c_4&1\end{matrix}\right]$$

$$D = \left[\begin{matrix} d_1\\d_2\\d_3\\d_4 \end{matrix}\right]$$

$$X = \left[\begin{matrix} x\\y\\z\\-u \end{matrix}\right]$$

The system can be rewritten as

$$A_1X+D=0$$

$$X=-A_1^{-1}D $$

Now as 

$$u =  -\left[\begin{matrix} 0&0&0&1 \end{matrix}\right]X$$

$$u =  \left[\begin{matrix} 0&0&0&1 \end{matrix}\right]A_1^{-1}D$$

$$u =  \frac{1}{\det{A_1}}\left[\begin{matrix} 0&0&0&1 \end{matrix}\right]\text{adj}{A_1}D$$

As the bottom row of $\text{adj}{A_1}$ equals

$$\left| \begin{matrix}a_2&b_2&c_2\\a_3&b_3&c_3\\a_4&b_4&c_4\end{matrix}\right|;\left| \begin{matrix} a_1&b_1&c_1\\a_3&b_3&c_3\\a_4&b_4&c_4\end{matrix}\right|;\left| \begin{matrix} a_1&b_1&c_1\\a_2&b_2&c_2\\a_4&b_4&c_4\end{matrix}\right|;\left| \begin{matrix} a_1&b_1&c_1\\a_2&b_2&c_2\\a_3&b_3&c_3\end{matrix}\right|$$

Then 
$$\left[\begin{matrix} 0&0&0&1 \end{matrix}\right]\text{adj}{A_1}D = d_1\det{A_1}+d_2\det{A_2}+d_3\det{A_3}+d_4\det{A_4}$$

If one defines:

$$M =\left[ \begin{matrix} a_1&b_1&c_1&d_1\\a_2&b_2&c_2&d_2\\a_3&b_3&c_3&d_3\\a_4&b_4&c_4&d_4\end{matrix}\right]$$

Then is

$$u = \frac{\det{M}}{\det{A_1}}$$

Analog is 

$$v = \frac{\det{M}}{\det{A_2}}\\w =\frac{\det{M}}{\det{A_3}}$$

Now the volume of the tetrahedron is the surface area of one of the faces time the height divided by 3, so if one takes the face to be the $vw$-plane, the volume is

$$\frac{u}{3} \times \frac{vw}{2} =  \frac{uvw}{6}$$

In $uvw$ space. In $xyz$ space the volume has to be divided by the Jacobian:

$$\left| \begin{matrix} a_1&b_1&c_1\\a_2&b_2&c_2\\a_3&b_3&c_3\end{matrix}\right|$$

which is $\det{A_4}$ so the final volume becomes:

$$\frac{\det{M}^3}{6\det{A_1}\det{A_2}\det{A_3}\det{A_4}}$$

Or expanded:
$$\frac{{\left| \begin{matrix} a_1&b_1&c_1&d_1\\a_2&b_2&c_2&d_2\\a_3&b_3&c_3&d_3\\a_4&b_4&c_4&d_4\end{matrix}\right|^3}}{6\left| \begin{matrix}a_2&b_2&c_2\\a_3&b_3&c_3\\a_4&b_4&c_4\end{matrix}\right|\left| \begin{matrix} a_1&b_1&c_1\\a_3&b_3&c_3\\a_4&b_4&c_4\end{matrix}\right|\left| \begin{matrix} a_1&b_1&c_1\\a_2&b_2&c_2\\a_4&b_4&c_4\end{matrix}\right|\left| \begin{matrix} a_1&b_1&c_1\\a_2&b_2&c_2\\a_3&b_3&c_3\end{matrix}\right|}$$