I ask you to solve this problem, because in the book and I have different answers
Point $M$ is the midpoint of the edge $AB$ of the cube $ABCDA_1B_1C_1D_1$. Find the distance between the straight lines $A_1M$ and $B_1C$, given that the edge of the cube is equal to $a$.
Please help me. It's Translated from Russian and it's the full context of the problem.

Let $H$ be the point on $A_1M$ such that $A_1H/HM=2$, and $K$ be the point on $B_1C$ such that $CK/KB_1=2$. Then it is not difficult to show that segment $HK$ is perpendicular to both $A_1M$ and $B_1C$ and is thus the distance between the lines.
To compute the length of $HK$ it may be useful to note that $HK={2\over3}GF$, where $G$ and $F$ are the midpoints of $A_1A$ and $B_1C_1$ respectively.