I think I have successfully proven the first two conditions, but the Triangle inequality one has me stumped. I've considered that for any $g, h^{-1}\in H_n$, there is also $g^{-1}, h \in H_n$, but I couldn't think of how to make that useful. How do I prove that $d(g,x)≤d(g,h)+d(h,x)$? Any help would be appreciated!
Let $G$ be a group, let $n ∈ N$, and suppose that $H_0, H_1, H_2, . . . , H_n$ are subgroups of $G$ such that:
{$e$} $= H_0 < H_1 < · · · < H_n = G$, with $H_i≠H_{i−1}$ for $i = 1, 2, . . . , n$.
We define a distance function $d_G : G × G → \mathbb{R}$ as follows:
$d(g, h) = k$, where $gh^{−1} ∈ H_k$ and $gh^{−1}\notin H_i$ for all $i < k$.
Show that $d$ is a metric by proving the non-negativity, symmetry and triangle inequality conditions.