Simple formula based on the definition of tofolli gate.
Definition- If two qubits are in up states simultaneously then flip the third qubit and in other configurations do nothing.
Mathematically-
\begin{equation}|\uparrow_1\uparrow_2\rangle\langle\uparrow_1\uparrow_2|\otimes\sigma_x + |\uparrow_1\downarrow_2\rangle\langle\uparrow_1\downarrow_2|\otimes I+|\downarrow_1\uparrow_2\rangle\langle\downarrow_1\uparrow_2|\otimes I+|\downarrow_1\downarrow_2\rangle\langle\downarrow_1\downarrow_2|\otimes I\end{equation}
where $\sigma_x$ is $x$-Pauli Matrix and $I$ is $2\times2$ Identity Matrix.
Up state for qubit one $|\uparrow_1\rangle = \begin{bmatrix}1 \ 0\end{bmatrix}$
Down state for qubit one $|\downarrow_1\rangle = \begin{bmatrix}0 \ 1\end{bmatrix}$
Up state for qubit two $|\uparrow_2\rangle = \begin{bmatrix}1 \ 0\end{bmatrix}$
Down state for qubit two $|\downarrow_2\rangle = \begin{bmatrix}0 \ 1\end{bmatrix}$
$|\uparrow_1\uparrow_2\rangle = \begin{bmatrix}1 \ 0\end{bmatrix} \otimes \begin{bmatrix}1 \ 0\end{bmatrix} = \begin{bmatrix}1 \ 0 \ 0 \ 0\end{bmatrix}$
and $|\uparrow_1\uparrow_2\rangle\langle\uparrow_1\uparrow_2| = \begin{bmatrix}1 \ 0 \ 0 \ 0\end{bmatrix}\otimes \begin{bmatrix}1 \ 0 \ 0 \ 0\end{bmatrix} = \begin{bmatrix}1 & 0 & 0 & 0 \0 & 0 & 0 & 0 \ 0 & 0 & 0 & 0 \ 0 & 0 & 0 & 0 \\end{bmatrix}$
Similarly you can construct other terms. 66