Let $X=C[0,1]$ be the set of all continuous functions on the interval $[0,1]$. Define:
$$d_1(f,g)= \sup {\{ \left \lvert {f(t)-g(t)} \right \rvert : \ t \in [0,1]} \}$$
I want to expand this supremum metric of continuous functions defined on $[0,1]$ to the supremum metric of continuous functions on any interval $[a,b]$, that is:
$$d_2(f,g)= \sup {\{ \left \lvert {f(t)-g(t)} \right \rvert : \ t \in [a,b]} \}$$
The following hint was proposed to me:
There exists a bijection from $C[a,b]$ to $C[0,1]$. For every function $f(x)$ on $C[a,b]$ we can define a function $g(x)$ on $C[0,1]$ with: $$g(x)=f \left(\frac{x-a}{b-a} \right)$$
I don't quite understand how this proves that if $d_1(f,g)$ is metric on $C[0,1]$, then $d_2$ is also a metric on $C[a,b]$. I imagine there is a certain theorem that connects these two.
The map you have given is in fact not a bijection; remark that if $0\leq b \leq 1$, $g$ is not even defined at $x=b$. Instead, for a function $f \in C[a,b]$, we define $g \in C[0,1]$ to be:
\begin{align*} g(x) = f \left( (b-a)x + a \right) \end{align*}
You should check for yourself that this is indeed a bijection. However, in your case, what would be more helpful is the inverse of this bijection, which would in fact be that $g \in C[0,1]$ maps to $f \in C[a,b]$, where:
\begin{align*} f(x) = g \left( \frac{x-a}{b-a} \right) \end{align*}
Now, we can show that your metric $d$ carries over to $C[a,b]$ (see remark at the bottom). Let $f_1, f_2 \in C[a,b]$, and let them be the images of $g_1, g_2 \in C[0,1]$ under the above bijection. Then we have:
\begin{align*} \sup \limits_{a \leq x \leq b} |f_1(x) - f_2(x)| = \sup \limits_{a \leq x \leq b} \left| g_1 \left( \frac{x-a}{b-a} \right) - g_2 \left( \frac{x-a}{b-a} \right) \right| \end{align*}
But in fact, since $x \mapsto \frac{x-a}{b-a}$ is a bijection from $[a,b]$ to $[0,1]$, this is in fact the same as:
\begin{align*} \sup \limits_{0 \leq y \leq 1} |g_1(y) - g_2(y)| \end{align*}
And so we have that:
\begin{align*} d(f_1,f_2) = d(g_1,g_2) \end{align*}
Therefore the metric is preserved when it is applied to the images of elements under this bijection, and so it is a metric on the resulting space.
REMARK: $d$ as you defined it is not actually a metric on $C[a,b]$; indeed with $d(g_1,g_2)$ we take the supremum of $|g_1(t) - g_2(t)|$ over $[0,1]$. This may not be defined for functions in $C[a,b]$. What you really need is a slightly modified metric $\tilde{d}$ which takes this supremum over $[a,b]$.