If you have a system (say, a gas) it is possible to change its internal energy by exchanging heat or work with the surrounding.
The first law tells us that when heat and/or work is exchanged the internal energy of the system changes.
This is written in mathematical form as:
where #E# is the internal energy. #Q# is heat and #W# is work.
The signs are a bit tricky though; I studied this law as I wrote it because there is a convention in it:
When heat enters the System it is considered POSITIVE;
When heat exits the System it is considered NEGATIVE;
When work enters the System it is considered NEGATIVE;
When work exits the System it is considered POSITIVE;
[I suspect that this convention comes from the Industrial Revolution and the birth of Thermodynamics; a machine that gave out work meant GOOD work...that gave money; while a machine that required work to operate meant BAD work or money you had to input. Heat out was also bad because meant loss in performance and so in money gained....I think]
The first law may seem complicated at first but you have to think at it in terms of exchange of energy.
I give you an example:
Imagine you have a gas in a cylinder that has a movable piston; visualize the internal energy of the gas as the vibration and movement of the gas particles.
Now let us give energy to the gas:
1) we heat the gas (we lit a fire under the cylinder): energy is communicated to the gas through heat #Q_"in">0# so the particles of the gas start to vibrate and move more rapidly: the Internal Energy Increased and:
#DeltaE=Q-0>0# [no work]
ex: you give #100J# of heat (heat in so positive) so the internal energy increases of: #DeltaE=100J#
2) we compress the gas: work is done on the gas #W_"in"<0# and again energy enters the gas and visually we compress the molecules of the gas that start to bump into each other more frequently increasing their energy=internal energy:
#DeltaE=0-W>0# [no heat and work "negative"]
ex: you give #100J# of work compressing the gas so you get: #W=-100J# because is in :
3) Now you heat the cylinder and let the piston expand: the internal energy increases because the heat BUT also decreases because work is done by the system!!!
ex: heat in (positive) #Q_"in"=100J# and expansion of the piston (work out, positive) #W_"out"=40J# we get:
#DeltaE=Q-W=100-(+40)=60J# the internal energy increased only #60J#
What I do it is always let the minus (in red below) of the formula fixed and insert in brackets the numerical values for #Q# and #W# with right signs (in or out) and perform the operation to get #DeltaE#:
Hope it helps!