REF.Image
Take 'O' as a corner
$$OA,OB,OC$$ are 3 edges through the axes
Let $$OA=OB=OC=a$$
coordinates of $$O=(o,o,o)$$
$$A(a,o,o) B(o,a,o) C(o,o,a)$$
$$P(a,a,o) L(o,a,a) M(a,o,a) N(a,a,o)$$
The four diagonals $$OP, AL, BM, CN$$
Direction cosine of $$OP : a-o,a-o,a-o = a,a,a = 1,1,1$$
Direction cosine of $$AL : o-a,a-o,a-o = -a,a,a = -1,1,1$$
Direction cosine of $$BM : a-o,o-a,a-o = a,-a,a = 1,-1,1$$
Direction cosine of $$CN : a-o,a-o,o-a = a,a,-a = 1,1,-1$$
$$\therefore $$ DC's of OP are $$\displaystyle\frac{1}{\sqrt{3}},\frac{1}{\sqrt{3}},\frac{1}{\sqrt{3}}$$
DC's of AL are $$\displaystyle\dfrac{-1}{\sqrt{3}},\dfrac{1}{\sqrt{3}},\frac{1}{\sqrt{3}}$$
DC's of BM are $$\displaystyle\dfrac{1}{\sqrt{3}},\dfrac{-1}{\sqrt{3}},\frac{1}{\sqrt{3}}$$
DC's of CN are $$\dfrac{1}{\sqrt{3}},\dfrac{1}{\sqrt{3}},\dfrac{-1}{\sqrt{3}}$$
Let l,m,n be dc's of line and line makes angle $$\alpha $$
with OP :- $$\displaystyle \cos \alpha = l(\frac{1}{\sqrt{3}})+m(\frac{1}{\sqrt{3}})+n(\frac{1}{\sqrt{3}})=\frac{l+m+n}{\sqrt{3}}$$
Similarly $$\cos\, \beta =\dfrac{-l+m+n}{\sqrt{3}}$$
$$\cos \delta = \dfrac{l+m-n}{\sqrt{3}}$$
$$\cos\gamma =\dfrac{l-m+n}{\sqrt{3}}$$
suaring and adding all the four
i.e ; $$\cos^{2}\alpha +\cos^{2}\beta +\cos^{2}\gamma +\cos^{2}\delta $$
$$= \dfrac{1}{3}[(l+m+n)^{2}+(-l+m+n)^{2}+(l-m+n)^{2}+(l+m-n)^{2}]$$
$$=\dfrac{1}{3}[4l^{2}+4m^{2}+4n^{2}]=\dfrac{4}{3}(l^{2}+m^{2}+n^{2})$$
$$[\because l^{2}+m^{2}+n^{2}=1]=\dfrac{4}{3}$$
$$\therefore \cos^{2}\alpha +\cos^{2}\beta +\cos^{2}\gamma +\cos^{2}\delta =\dfrac{4}{3}$$