Let us consider the following system (question 12.3 from Huang's Statistical Mechanics book)
A chain made of $N$ segments of equal length $a$ langs from the ceiling. $\mathrm{A}$ mass $m$ is attached to the other end under gravity. Each segment can be in either of two states, up or down, as illustrated in the sketch.
I'm trying to find the partition function of this system.
My work:
To that end, I put my coordinate axis to L distance below the ceiling such that the height of the mass $h$ is $L_0 = a(N-N_+)$ where $N_+$ is the #segments added in the downwards direction.
Now the partition function is equal to the sum of $e^{-\beta H}$ over all the microstates of the system. Since Hamiltonian is $H = mgh$, then $$Q_N = \sum_{\text{all possible $h$}} e^{-\frac{mgh}{k_bT}}.$$
Given that $N = N_+ + N_{-}$ and that $L = a(N_+ - N_-) = a(N-2N_+)$, $$h=L_0 - L = aN - 2a(N-N_+) = 2a (N-N_+)$$.
This means that $$Q_N = \sum_{N_+=0}^N e^{-\frac{mg2a (N-N_+)}{k_bT}} = e^{\frac{mga(2N)}{k_bT}} \sum_{N_+=0}^N e^{-\frac{-mg2aN_+)}{k_bT}}.$$
According to the wolframalpha, this equals to
$$Q_N = \frac{\left(-1+e^{mg2a+mg2a N}\right)}{-1+e^{mg2a}}.$$
This result is different from the one given in the book, namely $$Q_{N}=\left(1+\mathrm{e}^{-m g a / k T}\right)^{N}.$$
Question:
What am I doing wrong?
Addedum:
In the solution book, the answer is given as
Assume that a link can be up or down independently. The partition function is the product of the partition functions of the individual links. The possible energies are 0 and $m g a$. Thus $Q_{N}=[1+\exp (-\beta m g a)]^{N}$. We have ignored the fact that the energy of the $n$ th link depends on its height, and therefore on the states of the preceding links. We have also ignored is the restriction that the links cannot go above the ceiling.
But this is wrong. There is no energy associated with any link going down or up. Only the net result of all the alignment of the link, hence the total length, has an associated energy coming from the potential energy of the mass.