When you have unknown, or missing angles, you need to take the two given angles and add them together.
31° + 100° = 131°
After you added those together, you need to subtract the sum from 180°. Why do you only subtract 180°? Well, every angle or figure has 180°, nothing more.
180° - 131° = 49°
So, z = 49°
I hope I helped :)