Lets try to combine the vector field $\vec E$ and $\vec B$ which have 6 components into a scalar and vector field $\phi$ and $\vec A$ respectively which have four degrees of freedom in total which are the degrees of freedom of electromagnetism.
$\phi$ is the electric potential
$A$ is the magnetic vector potential
To show that this is possible we start with
$$ \begin{aligned} \vec\nabla \times \vec \nabla f&=0 \\ \vec \nabla \cdot \vec \nabla \times \vec v&=0 \end{aligned} $$
which holds for all scalar fields $f$ and vector fields $\vec v$
Consider the source-free Maxwell equations
$$ \begin{aligned} \vec \nabla \cdot \vec B&=0 \\ \vec \nabla \times \vec E+\vec B&=0 \end{aligned} $$
if we write
$$ \vec B= \vec \nabla \times \vec A $$
We know $\vec \nabla \cdot \vec B=0$ is satisfied due to $\vec \nabla \cdot \vec \nabla \times \vec v=0$
We can find that
$$ \vec\nabla \times \left ( \vec E+\dot{\vec A}\right ) =0 $$
which is satisfied by choosing $\vec E+\dot{\vec A}=-\vec\nabla \phi$
$$ \vec E=-\dot{\vec A}-\vec \nabla\phi $$
🗒️ Note: the minus is chosen by convention
The choice of $\phi$ and $\vec A$ is not unique. We can transform $\phi,\vec A$ according to
$$ \begin{aligned} \phi&\to\phi'=\phi-\dot \Psi \\ \vec A&\to \vec A'=\vec A+\vec \nabla \Psi
\end{aligned} $$
where $\Psi$ is an arbitrary scalar field. The electric and magnetic fields are unchanged implying that a family of solutions for $\phi$ and $\vec A$ exist.
For the electric field
$$ \vec E'=-\dot{\vec A'}-\nabla \phi'=-\left ( \vec{\dot A} +\vec \nabla \dot \Psi \right )-\vec\nabla \left ( \phi-\dot \Psi \right )=-\vec {\dot A}-\vec \nabla \phi= \vec E $$
This can be achieved for the magnetic field
This is an example of gauge freedom and it is controlled by imposing a condition on $\phi$ and $\vec A$ that links them so that unique electric and magnetic field are found.
We can fix the gauge by for example using the Lorenz Gauge
$$ \frac{1}{c^2}\dot \phi+\vec\nabla \cdot\vec A=0 $$
when $\phi$ is independent of time, this gauge condition becomes $\vec\nabla \cdot \vec A=0$ which is called the Coulomb gauge
🦪 Testing the gauge condition:
If we presume the Lorenz gauge is not satisfied for some $\phi$ and $\vec A$, then if we perform a gauge transformation we obtain
$$ \frac{1}{c^2}\dot \phi'+\vec\nabla \cdot\vec A'=\frac{1}{c^2}\dot \phi+\vec\nabla \cdot\vec A-\left ( \frac 1{c^2} \ddot \Psi -\nabla^2 \Psi\right ) $$
If we now choose $\Psi$ to be a solution of
$$ \frac{1}{c^2}\ddot \Psi -\nabla^2 \Psi=\frac{1}{c^2} \dot \phi +\vec\nabla \cdot \vec A $$
Which is a solvable wave equation where the right hand side is just a known forcing term, then it is always possible to find a $\Psi$ so that the Lorenz gauge condition is satisfied
We define the electric and magnetic field in terms of a scalar and vector field according to
$$ \vec B=\vec\nabla \times \vec A \qquad \vec E=-\dot{\vec A}-\vec \nabla \phi $$
🧞 Applying Our new terms into the sourced Maxwell equations ( Gauss’ law and the Ampere-Maxwell law)
Lets start with Gauss’ law
replace the electric field $\vec E$ with the scalar and magnetic potentials
$$ \vec \nabla\cdot \vec E=-\vec\nabla\cdot \left ( \vec\nabla \phi +\dot{\vec{A}} \right )=-\nabla^2\phi-\vec\nabla \cdot \dot{\vec{A}}=-\nabla^2\phi-\frac{\partial}{\partial t}\vec \nabla\cdot \vec A $$
We can use the Lorenz gauge condition to provide an expression for $\vec \nabla \cdot \vec A$ in terms of $\dot \phi$ so that
$$ \vec \nabla\cdot \vec E=-\nabla^2\phi+\frac{1}{c^2}\frac{\partial ^2\phi}{\partial t^2}=\frac{1}{\epsilon_0}\rho $$
Amperes law
Repeating a similar process
$$ \begin{aligned} \vec \nabla \times \vec B-\mu_0\epsilon_0 \dot{\vec E}&=\vec \nabla \times \vec \nabla \times \vec A+\mu_0\epsilon_0\left ( \vec \nabla \dot \phi +\ddot{ \vec A} \right ) \\ &=\vec \nabla (\vec \nabla \cdot \vec A)-\nabla^2 \vec A+\mu_0 \epsilon_0 ( -c^2 \vec \nabla (\vec \nabla \cdot \vec A)+\ddot{\vec A}) \\ &=-\nabla^2 \vec A+\frac{1}{c^2}\ddot{\vec A} \\ &=\mu_0 \vec j
\end{aligned} $$
To simplify these expressions we define a new operator
The differential “wave” operator
$$ \Box=\frac{1}{c^2}\frac{\partial^2}{\partial t^2}-\nabla^2 $$
then the equations for Amperes law and Gauss law become
$$ \Box\phi=\frac{\rho}{\epsilon_0} \qquad \Box\vec A=\mu_0 \vec j $$
💎 Conclusion: we have shown that by introducing the potential $\phi$ and $\vec A$ Maxwell equations become two sourced wave equations. The scalar potential $\phi$ is sources by the charge density $\rho$ and the vector potential $\vec A$ is sourced by the current density $\vec j$. Notice that the speed of these waves is $c$