In universal algebra, I am trying to show a counterexample using groups for the converse of "If an identity $s=t$ holds in $\mathcal{L}$-algebra $\mathcal{A}$, and $\mathcal{B}$ is a subalgebra of $\mathcal{A}$, then this identity also holds in $\mathcal{B}$".
My counterexample is the group $\mathbb{Z}_{n}$ with subgroup $U(n)=\left \{x\in \mathbb{Z}_{n}:gcd(x,n)=1 \right \}$. The identity $gcd(x,n)=1$ only holds in $U(n)$. Is this a valid counterexample?