<s>[INST] Explicit determination of a kernel of a linear map between modules. Consider the following $\mathbb Z[X]$-linear map of $\mathbb Z[X]$-modules:
$$\begin{array}{cccc}
f:&(\mathbb Z[X])^3&\to&\mathbb Z[X]\\
&(P,Q,R)&\mapsto&(X^2+1)P(X)+5XQ(X)+R(X)
\end{array}$$
The map is surjective (take $(P,Q,R)=(5,-X,-4)$). So, $\mathrm{Ker}\,f$ is a projective module. Since $(\mathbb Z[X])^3$ is a finitely generated module, $\mathrm{Ker}\,f$ is a finitely generated module. Here are my questions:
1) Is there an algorithmic way to determine a systems of generators of $\mathrm{Ker\, f}$?
2) Surely, $\mathrm{Ker}\,f$ is not a free module. But I can't prove or disprove this fact. 
Thanks in advance for any answers or hints to solve these two questions.  
 [/INST] Let $R = \mathbb{Z}[X]$.  With respect to the standard bases, the map $f: R^3 \to R$ has matrix representation
$$
A =
\begin{pmatrix}
X^2 + 1 & 5X & 1
\end{pmatrix} \, .
$$
We can compute Smith normal form of $A$ over the PID $\mathbb{Q}[X]$ by (row and) column operations.  We find $AQ = D$, where
$$
D =
\begin{pmatrix}
1 & 0 & 0
\end{pmatrix}
$$
and
$$
Q =
\begin{pmatrix}
0 & 0 & 1\\
0 & 1 & 0\\
1 & 0 & 0
\end{pmatrix}
\begin{pmatrix}
1 & -5X & -(X^2+1)\\
0 & 1 & 0\\
0 & 0 & 1
\end{pmatrix} =
\begin{pmatrix}
0 & 0 & 1\\
0 & 1 & 0\\
1 & -5X & -(X^2+1)
\end{pmatrix} \, .
$$
Interpreting $Q$ as a change of basis matrix, the columns of $Q$ give us a basis $\mathcal{B}$ of $R^3$ such that the matrix representation of $f$ with respect to $\mathcal{B}$ (and the basis $1$ in the codomain) is $D$.  Although we only knew the Smith normal form existed over $\mathbb{Q}[X]$, all operations took place over $\mathbb{Z}[X]$.  Thus the vectors
$$
\begin{pmatrix}
0\\ 0\\ 1
\end{pmatrix},
\quad
\begin{pmatrix}
0\\ 1\\ -5X
\end{pmatrix},
\quad
\begin{pmatrix}
1\\ 0\\ -X^2-1
\end{pmatrix}
$$
form a basis for $R^3$.  The image of the first vector generates the image of $f$, while the second and third vector generate $\ker(f)$.  Thus
$$
\ker(f) =
\begin{pmatrix}
0\\ 1\\ -5X
\end{pmatrix} R +
\begin{pmatrix}
1\\ 0\\ -X^2-1
\end{pmatrix} R
$$
as stated in the comments.
Actually, $\ker(f)$ is a free $R$-module.  Suppose
$$
\begin{pmatrix}
0\\ 0\\ 0
\end{pmatrix} =
a(X)
\begin{pmatrix}
0\\ 1\\ -5X
\end{pmatrix}
+ b(X)
\begin{pmatrix}
1\\ 0\\ -X^2-1
\end{pmatrix}
=
\begin{pmatrix}
b(X)\\ a(X)\\ -b(X) X^2 - 5a(X)X - b(X)
\end{pmatrix}
$$
is an $R$-linear relation between the vectors generating the kernel.  Examining the first and second entries, we find $a(X) = b(X) = 0$, so the relation must be trivial.  Thus
$$
\ker(f) =
\begin{pmatrix}
0\\ 1\\ -5X
\end{pmatrix} R \oplus
\begin{pmatrix}
1\\ 0\\ -X^2-1
\end{pmatrix} R
\cong R^2
$$
is freely generated by the two vectors found above.
I think your second question can also be answered by matrix operations.  Let $g: R^3 \to R$ be the map with matrix
$$
A = \begin{pmatrix} X^2 +1 & 5X & 2 \end{pmatrix}
$$
with respect to the standard basis.  We find a matrix $Q \in M_3(R)$ that puts $A$ into Smith normal form by the following column operations:
\begin{align*}
\left(\begin{array}{ccc}
X^{2} + 1 & 5X & 2 \\
\hline
 1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\end{array}\right)
&\leadsto
\left(\begin{array}{ccc}
X^{2} + 1 & X & 2 \\
\hline
 1 & 0 & 0 \\
0 & 1 & 0 \\
0 & -2X & 1
\end{array}\right)
\leadsto
\left(\begin{array}{ccc}
1 & X & 2 \\
\hline
 1 & 0 & 0 \\
-X & 1 & 0 \\
2X^{2} & -2X & 1
\end{array}\right)\\
&\leadsto
\left(\begin{array}{ccc}
1 & 0 & 0 \\
\hline
 1 & -X & -2 \\
-X & X^{2} + 1 & 2X \\
2X^{2} & -2X^{3} - 2X & -4X^{2} + 1
\end{array}\right)
\end{align*}
Thus the columns of the matrix
$$
Q =
\left(\begin{array}{ccc}
 1 & -X & -2 \\
-X & X^{2} + 1 & 2X \\
2X^{2} & -2X^{3} - 2X & -4X^{2} + 1
\end{array}\right)
$$
provide a basis for $R^3$ such that $g$ is given by the matrix $D = \begin{pmatrix} 1 & 0 & 0\end{pmatrix}$.  I think we can show by row and column operations that $\ker(g)$ is again freely generated by the second and third columns of $Q$:
\begin{align*}
\left(\begin{array}{r|r}
-X & -2 \\
X^{2} + 1 & 2X \\
-2X^{3} - 2X & -4X^{2} + 1
\end{array}\right)
&\leadsto
\left(\begin{array}{r|r}
2 & X \\
2X & X^{2} + 1 \\
-4X^{2} + 1 & -2X^{3} - 2X
\end{array}\right)
\leadsto
\left(\begin{array}{r|r}
2 & X \\
0 & 1 \\
1 & -2X
\end{array}\right)\\
&\leadsto
\left(\begin{array}{r|r}
1 & -2X \\
0 & 1 \\
2 & X
\end{array}\right)
\leadsto
\left(\begin{array}{r|r}
1 & 0 \\
0 & 1 \\
0 & 5X
\end{array}\right)
\leadsto
\left(\begin{array}{r|r}
1 & 0 \\
0 & 1 \\
0 & 0
\end{array}\right)
\end{align*}
but I need to think more about whether or not these row and column operations are invertible over $\mathbb{Z}[X]$.
</s>