Quotient ring $\frac{\mathbb{Z}_n[x]}{⟨f(x)^2⟩}$
-
For any field $k$ and nonzero polynomial $p \in k[x]$, the quotient ring $k[x]/(p)$ is a $k$-algebra of dimension $n:=\deg(p)$. In particular, as a $k$-vector space (hence as additive group) it is isomorphic to $\underbrace{k \, \oplus ... \oplus \,k}_{\deg(p)}$. -- Actually, if $p$ is monic, there is an "explicit" description of this $k$-algebra with matrices: Mapping $x$ to the companion matrix $C(p)$ of $p$ induces an isomorphism from $k[x]/(p)$ to the subring of $M_n(k)$ with $k$-basis $Id_n, C(p), C(p)^2, .., C(p)^{n-1}$. If you can multiply these matrices, you know everything you can know about the ring. But it's rather clear this translates the problem without necessarily making it easier: For example, nowhere in the above have we used whether $p$ is irreducible over the field $k$, which of course makes a big difference in the ring structure. This just goes to show these "explicit matrices" might not make everything about the ring "actually explicit".
-
So let's start over and look at the special case $f(x)=x$ first. Again for any field $k$, the ring $R:= k[x]/(x^2)$ is sometimes called the ring of "dual numbers" over $k$. We can write every element as $$a+bx$$ with unique $a,b \in k$, with obvious addition, and multiplication given by $$(a+bx)(c+dx) = ac + (bc+ad)x.$$ This is visibly equivalent to giving the underlying vector space $k \oplus k$ (cf. 1) the multiplication $$(a,b) \cdot (c,d) = (ac, bc+ad).$$ Here, the companion matrix is really easy and indeed we get to "see" this $k$-algebra as the commutative subalgebra $$\lbrace \pmatrix{a&0\\b&a}: a,b \in k \rbrace$$ of $M_2(k)$. In any case, the ring is a local $k$-algebra of dimension $2$ whose maximal ideal $\mathfrak m$ is generated by a nilpotent element whose square is zero. Both its residue field and its maximal ideal are isomorphic to $k$ as $k[x]$-modules, i.e. we have an exact sequence $$0 \rightarrow k \simeq (x)/(x^2) \xrightarrow{\subset} k[x]/(x^2) \xrightarrow{\text{mod } x} k \rightarrow 0.$$ This is an exact sequence of $k[x]/(x^2)$-modules (actually, of $k[x]$-modules) and also one of $k$-modules. Viewed as the latter, it splits by default, the splitting being induced by the natural inclusion $k \subset k[x]$ (this is just another way to say that the underlying $k$-vector space is $k \oplus k$). It does not split as sequence of $k[x]$- or $k[x]/(x^2)$-modules.
-
Side note for a flawed attempt in the question: The difference between $\mathbb Z/(p^2)$ and $\mathbb F_p[x]/(x^2)$. Admittedly, they have a lot in common. Both are artinian local rings whose maximal ideal is generated by an element $e$ with $e^2=0$, with residue field $\mathbb F_p$, and the maximal ideal is also isomorphic to $\mathbb F_p=R/\mathfrak m$ as module over the ring. I.e. both fit into exact sequences $$0 \rightarrow \mathbb F_p \rightarrow R_i \rightarrow \mathbb F_p \rightarrow 0$$ -- but exact sequences of what? For each $R_i$, this is an exact sequence of $R_i$-modules. But only for $R_2 = \mathbb F_p[x]/(x^2)$ is this also an exact sequence of $\mathbb F_p$-modules; in fact, $\mathbb Z/(p^2)$ (unlike $R_2$) does not have a natural structure of an $\mathbb F_p$-module at all -- if it had, each element in it would have additive order $p$. And relatedly, while the sequence of $R_2$-modules splits, the sequence of $R_1$-modules does not, not even the underlying sequence of additive groups splits: Because that would mean that there is an iso $\mathbb Z/(p^2) \simeq \mathbb Z/p \oplus \mathbb Z/p$ which is impossible because the left hand side has elements of order $p^2$, while the right hand side only has elements whose order is $1$ or $p$.
-
Now in general, what is $k[x]/(f^2)$ for an irreducible $f$? Let us call $F:= k[x]/(f)$ the field extension of $k$ given by that $f$. Well, a lot of the above goes through and $k[x]/(f^2)$ is a local $k$-algebra of $k$-dimension $2\deg(f)$ whose maximal ideal $\mathfrak m$ is generated by a nilpotent element whose square is zero. Both its residue field and its maximal ideal are isomorphic to $F$ as $k[x]$-modules, i.e. we have an exact sequence $$0 \rightarrow F \simeq (f)/(f^2) \xrightarrow{\subset} k[x]/(f^2) \xrightarrow{\text{mod } f} F \rightarrow 0.$$ This is an exact sequence of $k[x]/(f^2)$-modules (actually, of $k[x]$-modules) and also one of $k$-modules. However, in general we cannot view it as a sequence of $k[x]/(f) = F$-modules because the object in the middle does not have a natural structure as module over that ring. But as $k$-vector spaces, it splits by default and/or via 1 we can write the object in the middle as $$\underbrace{k \, \oplus ... \oplus \,k}_{\deg(p)} \oplus \underbrace{k \, \oplus ... \oplus \,k}_{\deg(p)} .$$ We want to write this just as $$k[x]/(f^2) \simeq F \oplus F$$ which we can do as long as we remember this is just an identification of $k$-vector spaces, i.e. we cannot expect the multiplication on this object to be $F$-linear. (Anyway, that being remembered, an obvious explicit such identification is to choose $\alpha \in F$ a root of $f$, then every element $d \in D$ can be written uniquely as $a_0 +a_1 \alpha + a_2 \alpha^2 + ... a_{\deg(f)-1} \alpha^{\deg(f)-1}$, and we send that element to (the residue modulo $(f^2)$ of) $a_0 +a_1 x+ a_2 x^2 + ... a_{\deg(f)-1} x^{\deg(f)-1}$.) -- We would like to endow this $$F \oplus F$$ with a multiplication $$(a,b) \cdot (c,d) \stackrel{?}= (ac, bc+ad)$$ but we cannot expect this to work. Why? There's no problem in identifications of both $k[x]/(f)$ and $(f)/(f^2)$ with $F$ as in the exact sequence above. Alternatively, one could argue with Euclidean algorithm to explicitly get elements $a,b \in k[x]$ with degree $\le \deg(f)-1$ to write an element in $k[x]$ (or $k[x]/(f^2)$) as $a +bf$ modulo $(f^2)$). But if we write those elements as polynomials and claim the calculation $(a + bf)(c+df) = ac+(ad+bc)f$ modulo $(f^2)$, we overlook that unlike in no. 2, for example $ac$ is not necessarily well-defined modulo $f^2$, only modulo $f$. In other words, one can indeed multiply $$(a,b) \cdot (0,d) = (0, ad)$$ but $(a,0) \cdot (c,0)$ is in general $(ac, m(a,c))$ where $m(a,c)$ is a non-zero map $F \times F \rightarrow F$ which certainly depends on the given polynomial $p$ and furthermore might depend on the given identifications. This is awkward, but if taken for granted at least gives us an "explicit" multiplication $$(a,b) \cdot (c,d) = (ac, ad+bc + m(a,c)).$$ To unravel this for a given polynomial $p$ might still not be significantly easier than the approach with companion matrices in no. 1.