We must calculate the equilibrium constant for the reaction, then calculate the free energy change.
Calculation of #K_P#
#color(white)(mmmm)"2HgO(s)" ⇌ "2Hg(g)"+"O"_2("g")#
#"I/atm:" color(white)(mmmmmmmml)0 color(white)(mmmll)0#
#"C/atm:" color(white)(mmmmmml)+2x color(white)(mll)+x#
#"E/atm:"color(white)(mmmmmmmm)2x color(white)(mmm)x#
#K_P = P_"Hg"^2P_"O₂" = (2x)^2x = 4x^3#
#P_"tot" = P_"Hg" +P_"O₂" = (2x + x) "atm" = 3xcolor(white)(l) "atm" = "4.0 atm"#
#x = 4.0/3 = 1.33#
#K_P = 4x^3 = 4 × 1.33^3 = 9.48#
Calculation of #ΔG#
#ΔG = "-"RTlnK = "-8.314 J·"color(red)(cancel(color(black)("K"^"-1")))"mol"^"-1" × 500 color(red)(cancel(color(black)("K"))) ln(9.48) = "-9350 J·mol"^"-1" = "-9.35 kJ/mol"#