Artificial intelligent assistant

Given a cubical box lined with mirrors, determine the distance a beam of light travels before returning to its starting point > A cubical box with sides of length 7 has vertices at $(0, 0, 0 )$, $(7, 0, 0 )$, $(0, 7, 0 )$, $(7, 7, 0)$, $(0, 0, 7)$, $(7, 0, 7)$, $(0, 7, 7)$, and $(7, 7, 7 )$. The inside of the box is lined with mirrors and from the point $(0, 1, 2)$, a beam of light is directed to the point $(1, 3, 4)$. The light then reflects repeatedly off the mirrors on the inside of the box. Determine how far the beam of light travels before it first returns to its starting point at $(0, 1, 2)$?

Note that the line equation coordinates is, with $u=[0 \ 1 \ 2 ]$ and $v=[1 \ 2 \ 2 ]$: $$ x_i=u_i+v_i\lambda $$

And the final point coordinates after $k_1,k_2,k_3$ reflections in each axis is: $$ y_i=14\lceil {k_i\over2}\rceil+(-1)^{k_i}u_i $$

Hence, solving: $$ 14\lceil {k_i\over2}\rceil+(-1)^{k_i}u_i=u_i+v_i\lambda $$

Taking the first option $k_1=0$, we obtain the trivial solution, $k_1=k_2=k_3=0$, $\lambda=0$, the same point.

Taking $k_1=1$: $$ 14\lceil {1\over2}\rceil=\lambda \to \lambda=14 \\\ 14\lceil {k_2\over2}\rceil+(-1)^{k_2}1=1+28 \to k_2=4 \\\ 14\lceil {k_3\over2}\rceil+(-1)^{k_3}2=2+28 \to k_3=4 $$

Hence, $\lambda=14$, the light ray travels through the vector $v\lambda=14[1 \ 2 \ 2]$ and the total travel distance is $42$.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 2f431fe5c8d7b5ebb1da65b65c4a3d6a