Derivation of maxwell's equations - how to make it mathematically correct?

So, we started from $$\oint \vec{E}d\vec{A}=\frac{Q}{\epsilon_0}$$ And used an electric dipole setup with $\vec{p}=q\vec{l}$ and $\vec{P}=\frac{\sum\vec{p}}{V}$, and reached the desired result: $$\oint \vec{D}d\vec{A}=Q_{real}$$ But I was thinking about an easier way. Formally: $$Q_{polarization}=\frac{\vec{p}}{\vec{l}}=\frac{\vec{P}V}{\vec{l}}=\vec{P}\vec{A}$$ But it's not correct mathematically. I think I should do some infinitesimal calculations to get $Q_{p}=\int \vec{P} d \vec{A}$, but how should I do it?

• Well one problem is that you cannot divide by a vector... – Aaron Stevens Jul 2 '18 at 13:17
• @AaronStevens As I wrote, it's a formal, mathematically not correct derivation. – 545941st user Jul 2 '18 at 13:20
• Maybe you could try rewriting as $q l\hat l$? – Aaron Stevens Jul 2 '18 at 13:29
• Suggestion to the post (v2): Replace the word Maxwell's equations with the word Gauss' law in various places. – Qmechanic Jul 2 '18 at 17:28