Take O as corner of the rectangular parallelpiped as origin and
OA,OB,OC the edges through axes.
( diagram )
Let OA=a,OB=b,OC=c then the coordinate of O,A,B,C are (0,0,0),(a,0,0),(0,b,0),(0,0,c) respectively.
The coordinates of other points are shown in figure.
The four diagonals are OP,AL,BM,CN
Direction cosines of OP are a−0,b−0,c−0 i.e, a,b,c respectively.
Direction cosines of AL are 0−a,b−0,c−0 i.e, −a,b,c respectively.
Direction cosines of BM are a−0,0−b,c−0 i.e, a,−b,c respectively.
Let Q be the angle OP and AL
∴cosα=(a)(−a)+(b)(b)+(c)(c)√a2+b2+c2√a2+b2+c2
=−a2+b2+c2a2+b2+c2
∴α=cos−1(−a2+b2+c2a2+b2+c2)
∴ angle between OP and AL is =cos−1(−a2+b2+c2a2+b2+c2)
similarly angle between OP and BM =cos−1(a2+b2−c2a2+b2+c2)
Proceeding this way we see that the angle between the diagonals are given by cos−1(a2±b2±c2a2+b2+c2)
Hence, solved.