Let $$A_i=\{\text{person }i\text{ receives both his own hat and his own coat}\}$$
We need the number of distributions in which none of the events $$A_1,A_2,\ldots,A_5$$ occurs.
The hats can be distributed in $$5!$$ ways and the coats can be distributed independently in $$5!$$ ways.
Hence total distributions are $$5!\times5!=120\times120=14400$$
Now apply the Principle of Inclusion-Exclusion.
If exactly one specified person, say person $$i$$, gets both his own hat and coat, then his hat and coat are fixed.
The remaining 4 hats and 4 coats can be distributed arbitrarily.
Therefore, $$N(A_i)=4!\times4!=576$$
Since there are $$\binom51$$ choices for the person, $$\sum N(A_i)=\binom51(4!)^2$$ $$=5\times576$$
$$=2880$$
If two specified persons get both their own hat and coat, then $$N(A_iA_j)=3!\times3!=36$$
Hence, $$\sum N(A_iA_j)=\binom52(3!)^2$$
$$=10\times36$$
$$=360$$
If three specified persons get both their own hat and coat, then $$N(A_iA_jA_k)=2!\times2!=4$$
Hence, $$\sum N(A_iA_jA_k)=\binom53(2!)^2$$
$$=10\times4$$
$$=40$$
If four specified persons get both their own hat and coat, then
$$N(A_iA_jA_kA_l)=1!\times1!=1$$
Hence,
$$\sum N(A_iA_jA_kA_l)=\binom54(1!)^2$$
$$=5$$
If all five persons get both their own hat and coat, then
$$N(A_1A_2A_3A_4A_5)=1$$
By Inclusion-Exclusion,
$$N=14400-2880+360-40+5-1$$
$$=11520+360-40+5-1$$
$$=11880-40+5-1$$
$$=11840+5-1$$
$$=11844$$
Final Answer :
$$11844$$