# Computing a geodesic (straight line) given any Riemannian metric

I am learning differential geometry, and I came up with the question on how to compute the straight line, given any Riemannian metric.

I have unsucessfuly tried to answer this question in $\mathbb{R}^2$ as follows. Consider the diagonal matrix $$M=\begin{bmatrix}m_{11}&0\\0&m_{22}\end{bmatrix},$$ where $m_{ii}\in\mathbb{R}_{>0}$. Since $M$ is constant, I know that the geodesic curve $\gamma:[0,1]\to\mathbb{R}^2$ is a straight line. Thus, $$\dfrac{d\gamma}{ds}\equiv C,$$ where $C$ is a constant real value. Consequently, the Fundamental Theorem of Calculus states that the equality $$\gamma(s) = \gamma(0) + \int_0^s C\,ds$$ holds, for every $s\in[0,1]$.

In terms of local coordinates. The Riemannian metric is defined, for every $x=(x_1, x_2)\in\mathbb{R}^2$, on the space tangent to $\mathbb{R}^2$ as $\mathbb{R}^2\ni(\delta x_1, \delta x_2)\to\delta x_1^\top M\delta x_2\in\mathbb{R}_{\geq0}$, where $\delta x_i$ stands for the components of the vector tangent to $x$.

By definition, the Riemannian metric is a local notion of weighted inner product. Thus, the differential element $ds$ can be rewritten as

$$ds=\sqrt{dx^\top M dx}=\sqrt{m_{11}dx_1^2 + m_{22}dx_2^2}.$$

Now comes the part that I cannot solve. How can I perform the integral and compute $\gamma(s)$, when

$$\gamma(s) = \gamma(0) + C\int_0^s \sqrt{m_{11}dx_1^2 + m_{22}dx_2^2}$$

?

Could someone please let me know what I am doing wrong?

$$\gamma(s)=\gamma(0) + \int_0^s C\,ds = \gamma(0) + Cs$$
Apparently, it does not play any role in the constant $C$, neither.