# Entropy with 2 card deck and 1 swap

I try to solve a problem and I don't know how to merge my result, what is the final result?

Problem: we have 2 card decks, each contains $n$ cards. If we swap 1 randomly chosen card from the 1st deck with a randomly chosen card from the 2nd deck. How much is the entropy ?

I think in the following way: 2 cases:

1. If we swap the same cards the entropy remains the same $$-n\left(\frac1n\right)\log_2\left(\frac1n\right)=\log_2(n)$$ because $$H(x) = -\sum p(i) \log_2(p(i))\;.$$

2. Or if we choose different cards then the entropy looks like this $$H(x) = -(n-2) \left(\frac1n\right)\log_2\left(\frac1n\right) - (1)\left(\frac2n\right)\log_2\left(\frac2n\right)$$ So in this case the deck contains 2 same card, then the probability on this event is doubled and the other (n-2) remains the same.

Is this the final result? Can I make a more general formula ?

 "How much is the entropy" of what? The entropy of a shuffled deck of $n$ different cards is presumably $\log_2(n!)$, right? Where are you getting your original $\log_2(n)$ from? – mjqxxxx Oct 20 '12 at 21:29 entropy of the 1st or the 2nd deck, its equal but how mucH? – flatronka Oct 21 '12 at 10:51 if the 1st deck contains n different card then the entropy is log2(n) because (1,2,3,4,5,6,7,8,9 ......n) p = (1/n, 1/n, 1/n, 1/n, 1/n .... 1/n) H(x) = -summa(p(i) * log2(p(i)) => log2(n) – flatronka Oct 21 '12 at 10:57