The following is from the book Design of Analog CMOS Integrated Circuit, page 313.
Calculate the voltage gain of the circuit. (channel length modulation and bulk effect are neglected)
At Node X with the help of KCL.
$$\frac{V_{in} - V_x} {R_S} = \frac{V_x - V_{out}} {R_F}$$
$$\Rightarrow V_x = \frac{V_{in} R_F + V_{out} R_S} {R_F + R_S}$$
At node \$V_{out}\$ with the help of KCL.
$$\frac{V_x - V_{out}} {R_F} - \frac{V_{out}} {R_D} = V_x g_{m}$$
So the gain will look like this when we subsitute \$\frac{V_{in} R_F + V_{out} R_S} {R_F + R_S}\$ for \$V_x\$.
$$\frac{V_{out}} {V_{in}} = \frac{(1 - g_m R_F) R_D} {R_D + R_F + R_S + R_D R_S g_m}$$
However, the book give the following.
$$\frac{V_{out}} {V_{in}} = \frac{1} {R_S} \cdot \frac{-(R_S \parallel R_F) g_m (R_F \parallel R_D)} {1 + g_m (R_F \parallel R_D) R_S / (R_S + R_F)} = \frac{- g_m R_F^2 R_D} {R_F R_S + R_D R_F + R_D R_S + R_F^2 + g_m R_F R_D R_S}$$
