Generalized Laws of Cosines and Sines I wonder the "laws of sines and cosines" in the two cases below and how to derive them. (or any related sources)
(i) For geodesic triangles on a sphere of radius $R>0$. (so constant curvature $1/R^2$)
(ii) On the upper half-plane, say $\{(x,y):y>0\}$ with metric $\frac{R^2}{y^2}\pmatrix{ 1& 0\\\ 0& 1}.$ (which has curvature $-1/R^2$)
Thank you so much.

A nice derivation for these formulas in the case $R = 1$ is 
Thurston's Three-Dimensional Geometry and Topology, Volume 1., pp. 74--81.
We think of $S^2$ as the unit sphere in $\mathbb{R}^3.$ Let $u, v, w$ be
points on the sphere. We draw a spherical triangle between them on the unit sphere.
Let $\theta_{u v}, \theta_{w u}, \theta_{v w}$ be, respectively, the lengths of
the sides $u v, w u, v w.$ Let $\phi_u, \phi_v, \phi_w$ be the angles in the triangle
at the respective vertices. 
The first spherical law of cosines (when $R = 1$) is
$$\cos \phi_w = \frac{\cos \theta_{u v} - \cos \theta_{w u} \cos \theta_{v w}}{\sin \theta_{v w} \sin \theta_{w u}};$$
the second is like it:
$$\cos \theta_{u v} = \frac{\cos \phi_v \cos \phi_u + \cos \phi_w}{\sin \phi_v \sin \phi_u}.$$
And the spherical law of sines is
$$\frac{\sin \theta_{u v}}{\sin \phi_w} = \frac{\sin \theta_{w u}}{\sin \phi_v} = \frac{\sin \theta_{v w}}{\sin \phi_u}.$$
So, if instead we were to consider a sphere of radius $R,$ then these formulas would become
$$\cos \phi_w = \frac{\cos (\theta_{u v}/R) - \cos (\theta_{u w}/R) \cos (\theta_{v w}/R)}{\sin (\theta_{u w}/R) \sin (\theta_{v w}/R)},$$
$$\cos (\theta_{u v}/R) = \frac{\cos \phi_v \cos \phi_u + \cos \phi_w}{\sin \phi_v \sin \phi_u},$$ and
$$\frac{\sin(\theta_{u v}/R)}{\sin\phi_w}=\frac{\sin(\theta_{w u}/R)}{\sin\phi_v}=\frac{\sin(\theta_{v w}/R)}{\sin\phi_u}.$$
We can see this from the fact that dilations about the origin preserve ratios of lengths, and angles.
To carry such intuition over to hyperbolic laws of cosines and sines, instead we should say that similarities preserve ratios of inner products. That is, a similarity $T: \mathbb{R}^3 \to \mathbb{R}^3$ satisfies, for the typical inner product on Euclidean space, 
$$\frac{\langle T a, T b \rangle}{\langle T c, T d \rangle} = \frac{\langle a, b \rangle}{\langle c,d \rangle}.$$ 
In fact, the above equation holds for any bilinear form $\langle\, ,\,\rangle.$ In particular, it holds for the Lorentz metric on three-space, which is
$$\left\langle \begin{pmatrix} v_0\\ v_1\\ v_2 \end{pmatrix}, \begin{pmatrix} w_0\\ w_1\\ w_2 \end{pmatrix}\right\rangle = -v_0 w_0 + v_1 w_1 + v_2 w_2.$$
This also defines an indefinite quadratic form $Q(v) = \langle v, v \rangle.$
Now, the usual hyperbolic plane is given by restricting this Lorentz metric to the "sphere of radius $i$," 
i.e. $\mathcal{H}^2 = \{v\,|\,Q(v) = -1\}.$ So suppose we have three points $u,v,w$ on this "pseudosphere," and as before, we draw the hyperbolic triangle with these points as vertices, and we call the lengths of the sides 
$\theta_{u v},\theta_{w u},\theta_{v w},$ and the angles at the respective vertices $\phi_u, \phi_v, \phi_w.$
Then the hyperbolic laws of cosines and sines are
$$\cosh \theta_{u v} = \cosh \theta_{w u} \cosh \theta_{v w} - \sinh \theta_{w u} \sinh \theta_{v w} \cos \phi_w,$$
$$\cos \phi_w = - \cos \phi_u \cos \phi_v + \sin \phi_u \sin \phi_v \cosh \theta_{u v},$$ and
$$\frac{\sinh \theta_{u v}}{\sin \phi_w}=\frac{\sinh \theta_{w u}}{\sin \phi_v}=\frac{\sinh \theta_{v w}}{\sin \phi_w}.$$
Again, a dilation about the origin won't change ratios of the Lorentz form. This implies that dilations don't change hyperbolic angles, since such angles are defined in terms of such ratios. Therefore, if instead we were to consider the pseudosphere of radius $iR,$ we would have the laws
$$\cosh (\theta_{u v}/R) = \cosh (\theta_{w u}/R) \cosh (\theta_{v w}/R) - \sinh (\theta_{w u}/R) \sinh (\theta_{v w}/R) \cos \phi_w,$$
$$\cos \phi_w = - \cos \phi_u \cos \phi_v + \sin \phi_u \sin \phi_v \cosh (\theta_{u v}/R),$$ and
$$\frac{\sinh (\theta_{u v}/R)}{\sin \phi_w}=\frac{\sinh (\theta_{w u}/R)}{\sin \phi_v}=\frac{\sinh (\theta_{v w}/R)}{\sin \phi_w}.$$
