This is not for homework. (I am a grader for a class.)
The case in which $G$ is finite is trivial. (That is, use a corollary to Lagrange's Theorem, and set $[G:H] = \dfrac{|G|}{|H|}$, and similarly for $[H:K]$.) How do you prove this for when $G$ is infinite?
The proof of this statement that I know well tries to show that $[G:K]$ is finite iff $[G:H]$ and $[H:K]$ are finite, but I am not a fan of that proof. For pedagogical purposes, I'm looking for a better proof. (The course uses right cosets by convention.)
The course has just started covering normal subgroups, so things like the Isomorphism Theorems are not known yet.