Is the map $f:S_n \to A_{n+2}$ given by
$$f(s)= \begin{cases} s & s\ \text{is even}\\ s \circ (n+1,\ n+2) & s\ \text{is odd} \end{cases}$$
an injective homomorphism? I can show that if it is a homomorphism then it is injective but having difficulty in showing that $f$ is a homomorphism. Please help.
As disjoint cycles commute and $\;(n+1\;n+2)^2=1\;$ , for any two cycles $\;\sigma,\pi\in S_n\;$ we get
$$f(\sigma\pi):=\begin{cases}\sigma\pi&,\text{both cycles have same parity}\\{}\\\sigma\pi(n+1\;n+2)=\sigma(n+1\;n+2)\pi=f(\sigma)f(\pi)&,\text{otherwise}\end{cases}$$
where $\;\sigma\;$ odd (first) case and $\;\pi\;$ even, and the other way around in the second case.
Now generalize using that any permutation is the product of disjoint cycles.