Chemistry - How can a nonspontaneous reaction occur?

Solution 1:

When you add energy from somewhere, let's say a battery, you are creating a greater amount of entropy there (in the battery or whatever). That's all there is to it. The Second Law is not violated.

The electrolysis process is not non-spontaneous. Yes, it would not occur in the absence of the battery. But the fact that it does occur with the battery there must tell you that overall it is spontaneous. The fact that you are coupling a strongly spontaneous reaction (discharge of the batter) with a non-spontaneous reaction (the electrolysis) means that overall, the electrolytic process is spontaneous.

It's incorrect to treat the electrolysis as if it occurs without the battery.

Solution 2:

Any reaction depends on two factors: enthalpy and entropy, and the summation of which is the change of the Gibbs energy by equation (for isobaric and isothermal process):

$$\Delta G = \Delta H - T \Delta S \qquad(1)$$ or, after manipulations we have

$$\frac{\Delta H-\Delta G}{T} = \Delta S \qquad(2)$$

The difference between equations (2) and one you've represented is the last one describes process of the hypothetical system (or real -> Universe) which always become to the initial state and there's no change of enthalpy: $$\Delta H = 0 \qquad(3)$$

If you will try to change Gibbs energy: $$\Delta G = G_2 - G_1 \qquad (4)$$ where$$G_i = H_i - TS_i \qquad (5)$$ or $$ G_i = U_i + PV_i - TS_i\qquad (6)$$ you have to change internal energy or volume of the system which will effect on enthalpy and the change of it: $$\Delta H \neq 0 \qquad(7)$$ and you will get the equation (2)

Answering on your question: handle the change of enthalpy (7) of the reaction.