[proofplan]
We prove the result directly from the definition of an isometry. For arbitrary points $x,x'\in X$, the composite satisfies $(g\circ f)(x)=g(f(x))$ and $(g\circ f)(x')=g(f(x'))$. Applying the distance-preserving property first to $g$ and then to $f$ gives exactly the distance-preserving identity required for $g\circ f$.
[/proofplan]
custom_env
admin
[step:Evaluate the composite on arbitrary points of $X$]
Let $x,x'\in X$ be arbitrary. Since $f:X\to Y$ and $g:Y\to Z$, the composite map
\begin{align*}
g\circ f:X\to Z
\end{align*}
is well-defined, and by the definition of function composition,
\begin{align*}
(g\circ f)(x)=g(f(x))
\end{align*}
and
\begin{align*}
(g\circ f)(x')=g(f(x')).
\end{align*}
[/step]
custom_env
admin
[step:Apply distance preservation for $g$ and then for $f$]Because $f(x),f(x')\in Y$ and $g:Y\to Z$ is an isometry, we have
\begin{align*}
d_Z(g(f(x)),g(f(x')))=d_Y(f(x),f(x')).
\end{align*}
Because $f:X\to Y$ is an isometry, we also have
\begin{align*}
d_Y(f(x),f(x'))=d_X(x,x').
\end{align*}
Combining these two equalities gives
\begin{align*}
d_Z((g\circ f)(x),(g\circ f)(x'))=d_X(x,x').
\end{align*}[/step]
custom_env
admin
[guided]We need to prove that $g\circ f$ preserves the distance between every pair of points in $X$. So fix arbitrary points $x,x'\in X$. Since $f:X\to Y$, both $f(x)$ and $f(x')$ are points of $Y$. This matters because the isometry property of $g$ applies to pairs of points in $Y$.
Now apply the defining property of the isometry $g:Y\to Z$ to the two points $f(x),f(x')\in Y$. This gives
\begin{align*}
d_Z(g(f(x)),g(f(x')))=d_Y(f(x),f(x')).
\end{align*}
The right-hand side is still a distance in $Y$, but the map $f:X\to Y$ is also an isometry. Applying the defining property of $f$ to the original points $x,x'\in X$ gives
\begin{align*}
d_Y(f(x),f(x'))=d_X(x,x').
\end{align*}
Substituting this equality into the previous one yields
\begin{align*}
d_Z(g(f(x)),g(f(x')))=d_X(x,x').
\end{align*}
Finally, by the definition of composition, $g(f(x))=(g\circ f)(x)$ and $g(f(x'))=(g\circ f)(x')$. Therefore
\begin{align*}
d_Z((g\circ f)(x),(g\circ f)(x'))=d_X(x,x').
\end{align*}
This is exactly the distance-preserving condition for the composite map $g\circ f:X\to Z$.[/guided]
custom_env
admin
[step:Conclude that the composite is an isometry]
Since $x,x'\in X$ were arbitrary, the identity
\begin{align*}
d_Z((g\circ f)(x),(g\circ f)(x'))=d_X(x,x')
\end{align*}
holds for all $x,x'\in X$. Hence $g\circ f:X\to Z$ is an isometry.
[/step]