The Gibbs free energy (G) of a reaction is a thermodynamic potential that measures the maximum amount of work that can be obtained from a system at constant temperature and pressure. The change in Gibbs free energy (ΔG) for a reaction is given by the equation:
ΔG = ΔH - TΔS
where ΔH is the change in enthalpy, T is the temperature in Kelvin, and ΔS is the change in entropy.
The Keq of a reaction is related to the Gibbs free energy change by the equation:
Keq = e^(-ΔG/RT)
where R is the ideal gas constant.
From the above equation, it can be seen that the Keq of a reaction increases as the temperature increases if the reaction is exothermic (ΔH is negative) and decreases as the temperature increases if the reaction is endothermic (ΔH is positive). This is because an exothermic reaction releases heat to the surroundings, which increases the entropy of the system and makes the reaction more favorable. Conversely, an endothermic reaction absorbs heat from the surroundings, which decreases the entropy of the system and makes the reaction less favorable.
In summary, temperature affects the Keq of a reaction by changing the Gibbs free energy change of the reaction. For an exothermic reaction, the Keq increases with increasing temperature, while for an endothermic reaction, the Keq decreases with increasing temperature.