Let $n \geq 0$ be a natural number. Consider the schemes
$$ \mathrm{GL}_n:=\operatorname{Spec}\left(\mathbb{Z}\left[X_{i, j} \mid 1 \leq i, j \leq n\right]_f\right),\quad \mu_m :=\operatorname{Spec}\left(\mathbb{Z}[X] /\left(X^n-1\right)\right)
$$
where $f:=\operatorname{det}\left(X_{i j}\right)_{i j} \in \mathbb{Z}\left[X_{i, j}\right]$ is the determinant of the matrix $\left(X_{i j}\right)_{i j} \in M_n\left(\mathbb{Z}\left[X_{i, j}\right]\right)$.
Prove that the contravariant functors
$$\begin{aligned}
& (\operatorname{Sch} / \operatorname{Spec} \mathbb{Z}) \longrightarrow(\text { Sets }), X \longmapsto \operatorname{GL}_n\left(\Gamma\left(X, \mathcal{O}_X\right)\right), \\
& (\operatorname{Sch} / \operatorname{Spec} \mathbb{Z}) \longrightarrow(\operatorname{Sets}), X \longmapsto \mu_m\left(\Gamma\left(X, \mathcal{O}_X\right)\right):=\left\{x \in \Gamma\left(X, \mathcal{O}_X\right) \mid x^n=1\right\}
\end{aligned}$$
are represented by the schemes $\mathrm{GL}_n$ and $\mu_m$, respectively.
I just started studying schemes as functors and I don't know how to solve this problem. Any help would be appreciated.
Hartshorne Exercise 2.4 gives a bijection $$\mathrm{Hom}_{Sch}(X,\mathrm{Spec}\ A)\to\mathrm{Hom}_{Rings}(A,\Gamma(X,\mathcal O_X))$$ for any scheme $X$ and ring $A$. Thus you have a bijection $$\mathrm{Hom}_{Sch}(X,\mathrm{GL}_n)\simeq\mathrm{Hom}_{Rings}(\mathbb Z[x_{ij}]_f,\Gamma(X,\mathcal O_X))\simeq \mathrm{GL}_n(\Gamma(X,\mathcal O_X)),$$ where the last isomorphism is given by sending $\varphi\colon\mathbb Z[x_{ij}]_f\to\Gamma(X,\mathcal O_X)$ to $(\varphi(x_{ij}))_{i,j}\in\mathrm{GL}_n(\Gamma(X,\mathcal O_X))$.
The proof for $\mu_m$ is similar.