Find the side length of an inscribed tilted cube in a spherical octant 
A cube of unknown side length is to be inscribed in the unit spherical octant where all coordinates are nonnegative.  The cube is tilted, and has four vertices belonging to the same cube face on the curved surface of the unit sphere, and two vertices lying on the $xy$ plane, and in addition one vertex on the $xz$ plane, and one vertex on the $yz$ plane.  This is shown in the figure above.  Calculate the tilt angle and the side length of this cube.
My attempt:  Knowing that the four vertices of a cube face lie on the surface of the sphere, it follows that the axis of the cube passing through its center and the center of this cube face, passes through the origin.  Using this fact, we can attach a local coordinate reference frame to the cube with it origin at the center of the cube, and parameterize it using the tilt angle, and the distance of the center of the cube from the world origin.  Then we can express the coordinates of vertices of the cube, using a third variable to represent the side length, and apply the conditions on their coordinates, as set by the question.  From here, the tilt angle and the side length can be found.  I got a tilt angle of $30^\circ$ and a side length of $\approx 0.5011$
 A: Attaching a coordinate reference frame to the cube with its $z'$ axis pointing from the origin towards the center of the cube, and its $x'$ axis horizontal (parallel to the $xy$ plane), we can express the coordinates of the vertices.
We have
$\hat{z'} = (\cos(\theta) \cos(\frac{\pi}{4}) , \cos(\theta) \sin(\frac{\pi}{4}), \sin(\theta)) $
where $\theta$ is the tilt angle.
$\hat{x'} = (-\cos(\frac{\pi}{4}), \sin(\frac{\pi}{4}), 0) $
It follows that
$\hat{y'} = (-\sin(\theta) \cos(\frac{\pi}{4}), - \sin(\theta) \sin(\frac{\pi}{4}) , \cos(\theta) ) $
The origin $O'$ of the this $O'x'y'z'$ frame is at the cube center $C$ where
$C = r $\hat{z'} $
If the side length of the cube is $s = 2a$ then, we have the following vertices coordinates expressed in the coordinate system $O'x'y'z'$
$P_1 = a (1, -1, -1  ), P_2 = a (1, 1, -1),  P_3 = (1, 1, 1) $
The corresponding world coordinates of these points are
$Q_1 = C + R P_1, Q_2 = C + R P_2 , Q_3 = C + RP_3 $
where $R = [\hat{x'} , \hat{y'} , \hat{z'} ] $
Hence,
$Q_1 = r \hat{z'} + a (\hat{x'} - \hat{y'} - \hat{z'} ) $
Plugging the expressions for the unit vectors above and letting $c_1 = \cos(\frac{\pi}{4}) = \frac{1}{\sqrt{2}}$, then
$Q_1 = \begin{bmatrix}  c_1( r  \cos \theta + a  (-1 +  \sin \theta -  \cos \theta))  \\
 c_1( r  \cos \theta + a ( 1 +  \sin \theta -  \cos \theta ) ) \\
 r \sin \theta + a (- \cos\theta - \sin \theta ) \end{bmatrix}$
Similarly, for $Q_2$
$Q_2 = r \hat{z'} + a (\hat{x'} + \hat{y'} - \hat{z'} ) $
$Q_2 = \begin{bmatrix}  c_1( r  \cos \theta + a  (-1 -  \sin \theta -  \cos \theta))  \\
 c_1( r  \cos \theta + a ( 1 -  \sin \theta -  \cos \theta ) ) \\
 r \sin \theta + a ( \cos\theta - \sin \theta ) \end{bmatrix}$
And,
$Q_3 = r \hat{z'} + a (\hat{x'} + \hat{y'} + \hat{z'} ) $
$Q_3 = \begin{bmatrix}  c_1( r  \cos \theta + a  (-1 -  \sin \theta +  \cos \theta))  \\
 c_1( r  \cos \theta + a ( 1 -  \sin \theta +  \cos \theta ) ) \\
 r \sin \theta + a ( \cos\theta + \sin \theta ) \end{bmatrix}$
Now we will impose the conditions on $Q_1$ , $Q_2$ and $Q_3$. We have that the $z$ coordinate of $Q_1$ is zero, therefore,
$ r \sin \theta + a (- \cos\theta - \sin \theta ) = 0 \hspace{20pt}(1)$
Next, we know that the $x$ coordinate of $Q_2$ is zero
$ r  \cos \theta + a  (-1 -  \sin \theta -  \cos \theta) = 0 \hspace{20pt}(2)$
Finally, point $Q_3$ is on the unit sphere.  Equations $(1)$ and $(2)$, (since $r, a$ are non-zero), imply that
$ \sin \theta (-1 - \sin \theta - \cos \theta) - \cos \theta( -\cos\theta - \sin \theta ) = 0 $
And this reduces to
$ - \sin \theta - \sin^2 \theta + \cos^2 \theta = 0 $
So,
$ 1 - 2 \sin^2 \theta = \sin \theta $
whose solution is $\theta = \dfrac{\pi}{6} $.
Using the found value of $\theta$ in equation $(1)$
$  r  - a (\sqrt{3} + 1 ) = 0 \hspace{20pt}(3)$
so that, $r = (1 + \sqrt{3}) a \hspace{20pt}(4) $
Using the value of $\theta$ and equation $(4)$ into the expression for $Q_3$, it becomes
$Q_3 = a \begin{bmatrix}   \frac{1}{2} c_1( 2 \sqrt{3})  \\
 \frac{1}{2} c_1( 4  + 2 \sqrt{3}  ) \\
  1 + \sqrt{3}  \end{bmatrix}$
Adding the squares of the components of $Q_3$ and equating that to $1$,
$ a^2 (\frac{1}{8} ( 12 + 16 + 12 + 16 \sqrt{3} ) + 4 + 2 \sqrt{3} ) = 1 $
Simplifying,
$a^2 ( 9 + 4 \sqrt{3} ) = 1 $
Hence
$ a = \dfrac{1}{\sqrt{ 9 + 4 \sqrt{3} }} $
Hence the side length is
$ s = 2 a  = \dfrac{2}{\sqrt{9 + 4 \sqrt{3}}} \approx 0.50112561417 $
