Explain how Earth's magnetic field is created. Include how the composition of the core and state of matter (solid, liquid, gas) influences it.