Fundamentals of Solid-State Phase Transitions, Ferromagnetism and Ferroelectricity