According to the first law of thermodynamics
∆U = ∆Q – ∆W
In the first process ∆U = 8 × 105 – 6.5 × 105 = 1.5 × 105 J
Now ∆U, being a state function, remains the same in the second process,
∆W = ∆Q – ∆U = 1 × 105 – 1.5 × 105 ∆W = – 0.5 × 105 J
The negative sign shows that work is done on the gas.