What you've stumbled upon is called the "Gibbs paradox", and the resolution is to divide the phase space for entropy calculations in statistical mechanics by the identical particle factor, which reduces the number of configurations.
Since the temperature is unchanged in the process, the momentum distribution of the atoms is unimportant, it is the same before and after, and the entropy is entirely spatial, as you realized. The volume of configuration space for the left part is:
${V_1^N \over N!}$
and for the right part is:
${V_2^N\over N!}$
And the total volume of the 2N particle configuration space is:
$(V_1V_2)^N\over (N!)^2$
When you lift the barrier, you get the spatial volume of configuration space
$(V_1 + V_2)^{2N} \over (2N)!$
When $V_1$ and $V_2$ are equal, you naively would expect zero entropy gain. But you do gain a tiny little bit of entropy by removing the wall. Before you removed the wall, the number of particles on the left and on the right were exactly equal, now they can fluctuate a little bit. But this is a negligible amount of extra entropy in the thermodynamic limit, as you can see:
${(2V)^{2N}\over (2N)!} = {2^{2N}(N!)^2\over (2N)!}{V^{2N}\over (N!)^2}$
So that the extra entropy from lifting the barrier is equal to:
$ \log ({(2N)!\over 2^{2N}(N!)^2})$
You might recognize the thing inside the log, it's the probability that a symmetric +/-1 random walk returns to the origin after N steps, i.e. the biggest term of the Pascal triangle at stage 2N when normalized by the sum of all the terms of Pascal's triangle at that stage. From the Brownian motion identity or equivalently, directly from Stirling's formula), you can estimate its size as ${1\over \sqrt{2\pi N}}$, so that the logarithm goes as log(N), it is sub-extensive, and vanishes for large numbers.
The entropy change in the general case is then exactly given by the logarithm of the ratio of the two configuration space volumes before and after:
$e^{\Delta S} = { V_1^N V_2^N \over (N!)^2 } { (2N)! \over (V_1 + V_2)^{2N}} = { V_1^N V_2^N \over ({V_1 + V_2 \over 2})^{2N}} {(2N)!\over 2^{2N}(N!)^2}$
Ignoring the thermodynamically negligible last factor, the macroscopic change in entropy, the part proprtional to N, is:
$\Delta S = N\log({4 V_1 V_2 \over (V_1 + V_2)^2})$
up to a sign, it is as you calculated.
Additional comments
You might think that it is weird to gain a little bit of entropy just from the fact that before you lift the wall you knew that the particle numbers were exactly N, even if that entropy is subextensive. Wouldn't that mean that when you lower the wall, you reduce the entropy a tiny subextensive amount, by preventing mixing of the right and left half? Even if the entropy decrease is tiny, it still violates the second law.
There is no entropy decrease, because when you lower the barrier, you don't know how many molecules are on the left and how many are on the right. If you add the entropy of ignorance to the entropy of the lowered wall system, it exactly removes the subextensive entropy loss. If you try to find out how many molecules are on the right vs how many are on the left, you produce more entropy in the process of learning the answer than you gain from the knowledge.
What we are dealing with here is an irreversible process, where some of the gas from chamber 2 at temperature $T_2$ flows through the intervening tube and mixes with the gas already present in chamber 1 at temperature $T_1$. This mixing gives rise to irreversibility present in the process. Accordingly, to establish the entropy change for this irreversible process, we must follow the standard procedure of first employing the first law of thermodynamics to establish the final state of the system, and then determining the entropy difference between the initial and final states. (Without establishing the final state of the system, it is not possible to determine the entropy change)
Were are told that at each stage of this process, the pressures within the two chambers are equal. This enables us to establish relationships for the number of moles in each chamber and for the pressure. Let the total number of moles in the two chambers be N, and let the initial number of moles in each chamber be $N_{10}$ and $N_{20}$. And let then number of moles in the two chamber at any other stage of the process be $N_1$ and $N_2$, such that $$N_1+N_2=N_{10}+N_{20}=N\tag{1}$$The condition of equal pressure in the two chambers requires that $$\frac{N_1T_1}{V_1}=\frac{N_2T_2}{V_2}\tag{2}$$If we combine Eqns. 1 and 2, we obtain:
$$N_1=\frac{V_1T_2}{(V_1T_2+V_2T_1)}N\tag{3a}$$and$$N_2=\frac{V_2T_1}{(V_1T_2+V_2T_1)}N\tag{3b}$$
And, for the pressure, we obtain: $$P=\frac{NRT_1T_2}{(V_1T_2+V_2T_1)}\tag{4}$$
Since each of the chambers is an open system, with gas flowing in or out, we must use the open system (control volume) version of the first law of thermodynamics to describe the energy balances. For chambers 1 and 2, these read respectively:
$$d(N_1u_1)=h_2dN_1\tag{5a}$$
$$d(N_2u_2)=h_2dN_2-PdV_2\tag{5b}$$where u and h represent internal energy and enthalpy per mole of gas. The terms $h_2dN_1$ and $h_2dN_2$ in these equations represent enthalpy flow from chamber 2 into chamber 1 and enthalpy flow out of chamber 2, respectively. If we combine Eqns. 3-5, we obtain two equations in two unknowns for the changes in $T_1$ and $T_2$ as functions of the changes in $V_2$.
Let us first work with Eqn. 5b. If we apply the product rule to the left hand side of this equation, we obtain:
$$N_2du_2=(h_2-u_2)dN_2-PdV_2\tag{6}$$But, for an ideal gas, we have: $du_2=C_vdT_2$, $h_2-u_2=RT_2$, and $P=N_2RT_2/V_2$; making these substitutions into Eqn. 6 yields: $$N_2C_vdT_2=RT_2dN_2-\frac{N_2RT_2}{V_2}dV_2\tag{7}$$Dividing this equation by $N_2T_2$yields an exact differential: $$d\ln{\left[T_2\left(\frac{V_2}{N_2}\right)^{R/C_v}\right]}=0\tag{8}$$or, combining this with Eqn. 3b yields:$$T_2\left(\frac{V_1T_2+V_2T_1}{T_1}\right)^{R/C_v}=T_{20}\left(\frac{V_1T_{20}+V_{20}T_{10}}{T_{10}}\right)^{R/C_v}\tag{9}$$
Once $V_2$ is specified, the only unknowns in Eqn. 9 are $T_1$ and $T_2$. Another equation relating these unknowns is provided by Eqn. 5a, the first law open system energy balance on chamber 1. Unfortunately, I have not been able to arrive at an analytic integration of this equation the way I have for Eqn. 5b. However, I will report on what I have obtained so far.
If we employ ideal gas relationships to Eqn. 5a similar to those used for Eqn. 5b, we obtain: $$C_vdT_1=[C_v(T_2-T_2)+RT_2]d\ln{N_1}\tag{10a}$$with $$d\ln{N_1}=d\ln{\left(\frac{T_2}{V_1T_2+V_2T_1}\right)}\tag{10b}$$
Maybe someone else can figure out a way of analytically integrating Eqns. 10, subject to Eqns. 9 to obtain $T_1$ and $T_2$ as functions of $V_2$. So far this has eluded me. As noted previously, we need to obtain these functional relationships in order to determine the change in entropy of the system as a unique function of $V_2$. In practice, if I could not carry out the integration of the equations analytically, I would resort to numerical integration.
ADDENDUM
I did some additional analysis on this problem and was able to simplify Eqns. 10 by combining them with Eqn. 9 to obtain:
$$\frac{dT_1}{dT_2}=\frac{C_v}{R}\frac{T_1}{T_2}\left(\frac{C_p}{C_v}-\frac{T_1}{T_2}\right)\tag{11}$$Note that this equation no longer contains the volumes, and thus describes how $T_1$ must vary in tandem with $T_2$, starting with specified initial values of these parameters, for any arbitrary variation in $V_2$.
GOOD NEWS. (3/5/18)
I've finally been successful in integrating Eqn. 11 analytically to obtain $T_1$ as an explicit function of $T_2$. The result is:
$$T_1=\frac{T_2}{\left[1+\left(\frac{T_{20}}{T_{10}}-1\right)\left(\frac{T_{20}}{T_2}\right)^{C_v/R}\right]}\tag{11a}$$
Note from this that, as would be expected, if $T_{10}=T_{20}$, $T_1=T_2$
CHANGE IN ENTROPY
The change in entropy for this system is given by:
$$\Delta S=(N_1s_1+N_2s_2)-(N_{10}s_{10}+N_{20}s_{20})\tag{12}$$
where the s's are molar entropies:
$$s=C_v\ln{(T/T_{ref})}+R\ln{(v/v_{ref})}\tag{13}$$where $T_{ref}$ and $v_{ref}$ are the temperature and molar volume at some arbitrary reference state; these parameters cancel out of the calculations. The specific volume $v_j$ for chamber j is given by $v_j=V_j/N_j$.
ADDITIONAL ANALYSIS ON 3/5/18
Intuitively, and, based on Eqns. 8 and 9 of the present analysis, we know that the gas remaining in chamber 2 at any time during this process has experienced an adiabatic reversible compression, such that its final entropy per unit mass is equal to its initial entropy per unit mass: $$s_2=s_{20}$$If we substitute this into Eqn. 12, this yields:
$$\Delta S=N_1s_1-N_{10}s_{10}-(N_{20}-N_2)s_{20}\tag{14}$$
Unfortunately, the same kind of simplification can not be made for chamber 1. However, further simplification is possible in the following way: We can substitute the identity $N_1=N_{10}+(N_1-N_{10}$ Into Eqn. 14 to obtain: $$\Delta S=N_{10}(s_1-s_{10})+(N_1-N_{10})s_1-(N_{20}-N_2)s_2\tag{15}$$But, from the material balance, we have, $$(N_1-N_{10})=(N_{20}-N_2)$$Substituting this into equation 15 then yields:
$$\Delta S=N_{10}(s_1-s_{10})-(N_{20}-N_2)(s_2-s_1)\tag{16}$$But, since the pressures are equal in chambers 1 and 2, the term $(s_2-s_1)$ is just:
$(s_2-s_1)=C_p\ln{(T_2/T_1)}$. Therefore, Eqn. 16 becomes:
$$\Delta S=N_{10}(s_1-s_{10})-(N_{20}-N_2)C_p\ln{(T_2/T_1)}\tag{17}$$
CALCULATING THE ENTROPY CHANGE:
- Specify a value for $T_2$
- Use Eqn. 11 to calculate the corresponding value of $T_1$
- Use Eqn. 9 to calculate the corresponding value of $V_2$
- Use Eqns. 3 to calculate the values of $N_1$, $N_2$, $N_{10}$, and $N_{20}$
- Plug values into Eqn. for entropy change
Best Answer
Entropy is function of state multiplicity. If you have the same gas, you wouldn't change state multiplicity and thus cannot change its entropy. That's different if two gases are different.