Let us denote by $d_m$ the number of sequences $(a_1,a_2,…,a_m)$ such that $a_i \ne i$ for every integer $i \in \{1,2,…,m\}$ . Prove that for each $m \ge 3$ the following holds: $$d_m=(m-1)(d_{m-1}+d_{m-2})$$
Since the following formula $d(n)=n!(1-\frac{1}{1!}+\frac{1}{2!}-\frac{1}{3!}+\frac{1}{4!}- \cdots +(-1)^n\frac{1}{n!})$ is not what we have to prove and this is how to find the number of derangements for $n$ distinct objects, can I answer this question by substituting $d(n)$ for $d_m$, $d(n-1)$ for $d_{m-1}$ and $d(n-2)$ for $d_{m-2}$ and using algebra to show that they are equal? Do I need to use mathematical induction and also show that they are equal for $n+1$ or do I need to solve this problem a different way?