Introduction to electromagnetism

Electromagnetism is one of the fundamental forces of nature. Early on, electricity and magnetism were studied separately and regarded as separate phenomena. Hans Christian Ørsted discovered that the two were related – electric currents give rise to magnetism. Michael Faraday discovered the converse, that magnetism could induce electric currents, and James Clerk Maxwell put the whole thing together in a unified theory of electromagnetism. Maxwell's equations further indicated that electromagnetic waves existed, and the experiments of Heinrich Hertz confirmed this, making radio possible. Maxwell also postulated, correctly, that light was a form of electromagnetic wave, thus making all of optics a branch of electromagnetism. Radio waves differ from light only in that the wavelength of the former is much longer than the latter. Albert Einstein showed that the magnetic field arises through the relativistic motion of the electric field and thus magnetism is merely a side effect of electricity. The modern theoretical treatment of electromagnetism is as a quantum field in quantum electrodynamics.
In many situations of interest to electrical engineering, it is not necessary to apply quantum theory to get correct results. Classical physics is still an accurate approximation in most situations involving macroscopic objects. With few exceptions, quantum theory is only necessary at the atomic scale and a simpler classical treatment can be applied. Further simplifications of treatment are possible in limited situations. Electrostatics deals only with stationary electric charges so magnetic fields do not arise and are not considered. Permanent magnets can be described without reference to electricity or electromagnetism. Circuit theory deals with electrical networks where the fields are largely confined around current carrying conductors. In such circuits, even Maxwell's equations can be dispensed with and simpler formulations used. On the other hand, a quantum treatment of electromagnetism is important in chemistry. Chemical reactions and chemical bonding are the result of quantum mechanical interactions of electrons around atoms. Quantum considerations are also necessary to explain the behaviour of many electronic devices, for instance the tunnel diode.
Electric charge.
Electromagnetism is one of the fundamental forces of nature alongside gravity, the strong force and the weak force . Whereas gravity acts on all things that have mass, electromagnetism acts on all things that have electric charge. But unlike gravity, whilst mass can only be positive, charge can be both positive and negative. Furthermore, whilst positive masses exert an attractive gravitational force on one another, positive charges exert an attractive electric force only on oppositely charged negative charges (and vice versa) and a repulsive electric force on other positive charges (negative charges also repel other negative charges). The electric force between charged particles is called the Coulomb force and is described by Coulomb's law which states that the electric force between two charges is directly proportional to the product of the magnitudes of the charges and inversely proportional to the square of the distance between them:
formula_1
where "F" is the Coulomb force, "ke" is the Coulomb constant, "q1" and "q2" are the charges of the two particles, and "r2" is the square of the distance between them.
Electric charge has several important properties:
The overall electromagnetic force on a charged particle is a combination of the electric and magnetic forces on it and is called the Lorentz force:
formula_12
In all equations shown, symbols in bold are vector quantities and the electric and magnetic fields are vector fields. For more information on the mathematics used here, see cross product and vector calculus.
Electricity.
Electric flux and Gauss' law.
Flux can be thought of as the flow of the electric or magnetic field through a surface. Flux flowing through a surface is analogous to the flow of a fluid through a surface; the greater the density of flow and the greater the size of the surface, the more that can flow through it and the greater the angle between the surface and the direction of flow, the less that can flow through. Gauss' law is the first of Maxwell's equations and states that the electric flux formula_13 through a closed surface is proportional to the amount of charge enclosed within it:
formula_14
where "Q" is the total charge enclosed by the surface, and formula_15 is the permittivity of free space. 
This means that the more electric charge there is, the more electric flux is produced. From the equation, we can see that when there is a net positive charge inside the surface (with flux flowing out of the enclosed volume because electric field lines start at positive charges), the electric flux is defined as positive and when there is a net negative charge inside the surface (with flux flowing into the enclosed volume), the electric flux is defined as negative. 
If there is no charge enclosed by the surface, then the electric flux must be zero. This means that when there is no charge enclosed by the surface either there are no field lines going through the surface at all or the flux flowing in through the surface must cancel out with the flux flowing out of the surface.
Electric potential and potential energy.
The electric potential energy of a system is defined as the amount of physical work it would take to move all the charges in the system from very far away to the configuration that they are currently in and can be thought of as the energy stored in the electric field for a given configuration of charges. Another way of thinking about the electric potential energy is as analogously to gravitational potential energy; like a mass released from high up will convert its gravitational potential energy to kinetic energy as it falls to the ground, separated charges will convert their electric potential energy to kinetic energy as they are accelerated either attractively towards one another or repulsively away from one another.
The electric potential of a system is defined as the electric potential energy per unit charge:
formula_16
where formula_17 is the electric potential, "UE" is the electric potential energy, and "Q" is the total charge of the system. The potential difference (also known as voltage) between two points is defined as the work required to move a charge between those two points. Another equivalent definition of the electric potential is in terms of the electric field. For a static electric field, the electric field is defined to be minus the gradient of the electric potential and so the electric field can be thought of as a field that points away from high potentials towards low potentials. Electric fields point from positive charges to negative charges (and opposite charges attract) so this definition tells us that positive charges are attracted to low potentials and negative charges are attracted to high potentials. 
Magnetism.
Gauss' law for magnetism.
The second of Mawell's equations is Gauss' law for magnetism which states that the magnetic flux formula_18 through a closed surface is always equal to zero:
formula_19
This law has colloquially been called "no magnetic monopoles" because it means that magnetic fields do not begin or end at single monopolar magnetic charges (unlike electric fields which begin at positive charges and end at negative charges) but that magnets must always have more than one pole. For example, permanent magnets have a North and a South pole and so are magnetic dipoles and there can also be quadrupole magnets with four poles.
Magnets.
Magnets are materials that produce their own magnetic fields. All magnets have North and South poles and the magnetic field produced by them points from the North to the South pole. Like electric charges, opposite magnetic poles attract one another and like magnetic poles repel one another but, unlike electric charges, magnetic poles cannot exist on their own (as shown by Gauss' law for magnetism) and so North and South poles must come together.
Materials that are attracted to magnets and which can be themselves magnetised are called ferromagnetic materials. Ferromagnetic materials can be magnetised because when their electron's spin magnetic moments are aligned with an external magnetic field, they sustain their own internal magnetic field even when the external magnetic field is removed. Examples of ferromagnetic materials which can be magnetised with external magnetic fields to create magnets are iron, nickel and cobalt.
The Biot–Savart law.
Ampère's circuital law states that an electric current will induce a magnetic field. 
A specific case is given by the Biot–Savart law which states that when there are no time-varying electric or magnetic fields, the strength of a magnetic field produced by a steady current in a long, straight wire is proportional to the strength of the current and inversely proportional to the distance from the wire. The direction of the magnetic field can be found using Ampère's right-hand grip rule which shows that the magnetic field will be curled around the current-carrying wire clockwise or anticlockwise depending on the direction of current flow. The right-hand grip rule can also be used for current passing through a solenoidal wire producing a magnetic field inside the coil. This principle is utilised by electromagnets which consist of a wire coiled around an iron core. Current is passed through the wire creating a magnetic field in the iron core. This magnetic field aligns the spins of the electrons in the iron which contribute to magnetic field making it stronger.
The Biot–Savart law for a charged particle states that the magnetic field "B(r)" produced by a moving charged particle is proportional to the charge "q" and velocity "v" of the particle and inversely proportional to the square of the distance away from it "r2":
formula_20
where formula_21 is the permeability of free space and formula_22 is the magnitude of the cross product between the velocity and a unit vector formula_23 pointing from the charge to the point where the magnetic field is being calculated which is equal to the magnitude of the velocity times the sine of the angle formula_11 between the direction of motion of the charge and the direction of formula_23.
Electromagnetic unification.
Maxwell's equations and electromagnetic radiation.
Maxwell's equations consist of Gauss' laws for electricity and magnetism (as described above) as well as the Maxwell-Faraday equation and the Ampère–Maxwell equation. The Maxwell-Faraday equation states that a time-varying magnetic field produces an electric field whilst the Ampère–Maxwell equation extends Ampère's circuital law to include the statement that a time-varying electric field (as well as an electric current) will produce a magnetic field. Together Maxwell's equations provide a single uniform theory of electromagnetism and Maxwell's work in creating this theory has been called "the second great unification in physics" after the first great unification of Newton's law of universal gravitation. The solution to Maxwell's equations in free space (where there are no charges or currents) produces wave equations corresponding to electromagnetic waves (with both electric and magnetic components) travelling at the speed of light. The observation that these wave solutions had a wave speed equal to the speed of light led Maxwell to conclude that light is a form of electromagnetic radiation and to posit that other electromagnetic radiation could exist with different wavelengths. The existence of electromagnetic radiation was proved by Heinrich Hertz in a series of experiments ranging from 1886 to 1889 in which he discovered the existence of radio waves. The full electromagnetic spectrum (in order of increasing frequency) consists of radio waves, microwaves, infrared radiation, visible light, ultraviolet light, X-rays and gamma rays.
Special relativity.
According to Einstein's special theory of relativity, observers moving at different speeds relative to one another occupy different observational frames of reference. If one observer is in motion relative to another observer then they experience length contraction where unmoving objects appear closer together to the observer in motion than to the observer at rest. Therefore, if an electron is moving at the same speed as the current in a neutral wire, then they experience the flowing electrons in the wire as standing still relative to it and the positive charges as contracted together. In the lab frame, the electron is moving and so feels a magnetic force from the current in the wire but because the wire is neutral it feels no electric force. But in the electron's rest frame, the positive charges seem closer together compared to the flowing electrons and so the wire seems positively charged. Therefore, in the electron's rest frame it feels no magnetic force (because it is not moving in its own frame) but it does feel an electric force due to the positively charged wire. This result from relativity proves that magnetic fields are just electric fields in a different reference frame (and vice versa) and so the two are different manifestations of the same underlying electromagnetic field.
Conductors, insulators and circuits.
Conductors.
A conductor is a material that allows electrons to flow easily. The most effective conductors are usually metals because they can be described fairly accurately by the free electron model in which electrons delocalize from the atomic nuclei, leaving positive ions surrounded by a cloud of free electrons. Examples of good conductors include copper, aluminum, and silver. Wires in electronics are often made of copper.
The main properties of conductors are:
In some materials, the electrons are bound to the atomic nuclei and so are not free to move around but the energy required to set them free is low. In these materials, called semiconductors, the conductivity is low at low temperatures but as the temperature is increased the electrons gain more thermal energy and the conductivity increases. Silicon is an example of a semiconductors that can be used to create solar panels which become more conductive the more energy they receive from photons from the sun.
Superconductors are materials that exhibit little to no resistance to the flow of electrons when cooled below a certain critical temperature. Superconductivity can only be explained by the quantum mechanical Pauli exclusion principle which states that no two fermions (an electron is a type of fermion) can occupy exactly the same quantum state. In superconductors, below a certain temperature the electrons form boson bound pairs which do not follow this principle and this means that all the electrons can fall to the same energy level and move together uniformly in a current.
Insulators.
Insulators are material which are highly resistive to the flow of electrons and so are often used to cover conducting wires for safety. In insulators, electrons are tightly bound to atomic nuclei and the energy to free them is very high so they are not free to move and are resistive to induced movement by an external electric field. However, some insulators, called dielectrics, can be polarised under the influence of an external electric field so that the charges are minutely displaced forming dipoles that create a positive and negative side. Dielectrics are used in capacitors to allow them to store more electric potential energy in the electric field between the capacitor plates.
Capacitors.
A capacitor is an electronic component that stores electrical potential energy in an electric field between two oppositely charged conducting plates. If one of the conducting plates has a charge density of +"Q/A" and the other has a charge of -"Q/A" where "A" is the area of the plates, then there will be an electric field between them. The potential difference between two parallel plates "V" can be derived mathematically as
formula_26
where "d" is the plate separation and formula_15 is the permittivity of free space. The ability of the capacitor to store electrical potential energy is measured by the capacitance which is defined as formula_28 and for a parallel plate capacitor this is
formula_29
If a dielectric is placed between the plates then the permittivity of free space is multiplied by the relative permittivity of the dielectric and the capacitance increases. The maximum energy that can be stored by a capacitor is proportional to the capacitance and the square of the potential difference between the plates
formula_30
Inductors.
An inductor is an electronic component that stores energy in a magnetic field inside a coil of wire. A current-carrying coil of wire induces a magnetic field according to Ampère's circuital law. The greater the current "I", the greater the energy stored in the magnetic field and the lower the inductance which is defined formula_31 where formula_18 is the magnetic flux produced by the coil of wire. The inductance is a measure of the circuits resistance to a change in current and so inductors with high inductances can also be used to oppose alternating current.
Circuit laws.
Circuit theory deals with electrical networks where the fields are largely confined around current carrying conductors. In such circuits, simple circuit laws can be used instead of deriving all the behaviour of the circuits directly from electromagnetic laws. Ohm's law states the relationship between the current "I" and the voltage "V" of a circuit by introducing the quantity known as resistance "R"
Ohm's law: formula_33
Power is defined as formula_34 so Ohm's law can be used to tell us the power of the circuit in terms of other quantities
formula_35
Kirchhoff's junction rule states that the current going into a junction (or node) must equal the current that leaves the node. This comes from charge conservation, as current is defined as the flow of charge over time. If a current splits as it exits a junction, the sum of the resultant split currents is equal to the incoming circuit.
Kirchhoff's loop rule states that the sum of the voltage in a closed loop around a circuit equals zero. This comes from the fact that the electric field is conservative which means that no matter the path taken, the potential at a point doesn't change when you get back there.
Rules can also tell us how to add up quantities such as the current and voltage in series and parallel circuits.
For series circuits, the current remains the same for each component and the voltages and resistances add up:
formula_36
For parallel circuits, the voltage remains the same for each component and the currents and resistances are related as shown:
formula_37