Let the Poincaré Half Plane be the set $\{(x, y) \in \mathbb{R}^2 : y > 0\}$. It is a known result that the the metric
$ds^2 = \frac{dx^2 + dy^2}{y^2}$
yields a distance function $f$ such that its output is the length of the geodesic between two points on the Poincaré Half Plane. Through some process that I do not understand, it is possible to prove that
$f((x_1, y_1), (x_2, y_2)) = \operatorname{arcosh} \left( 1 + \frac{ {(x_2 - x_1)}^2 + {(y_2 - y_1)}^2 }{ 2 y_1 y_2 } \right)$.
How does one prove the previous equality from the given metric?