Step 1: Calculate the initial electrostatic potential energy.
The energy stored in a capacitor with capacitance \(C\) and potential difference \(V\) is given by \(U = \frac{1}{2}CV^2\).
For the first capacitor, charged to potential \(V_1\):
\[
U_1 = \frac{1}{2}CV_1^2
\]
For the second capacitor, charged to potential \(V_2\):
\[
U_2 = \frac{1}{2}CV_2^2
\]
The total initial energy of the system is the sum of the energies of the individual capacitors:
\[
U_{initial} = U_1 + U_2 = \frac{1}{2}CV_1^2 + \frac{1}{2}CV_2^2 = \frac{1}{2}C(V_1^2 + V_2^2)
\]
Step 2: Calculate the final electrostatic potential energy after connecting like plates.
When the two identical capacitors are connected with their like plates together (positive to positive, negative to negative), they are effectively connected in parallel.
The total capacitance of the parallel combination is \(C_{total} = C + C = 2C\).
The initial charge on the first capacitor is \(Q_1 = CV_1\).
The initial charge on the second capacitor is \(Q_2 = CV_2\).
When connected with like plates, the total charge on the combined system is the algebraic sum of their initial charges:
\[
Q_{total} = Q_1 + Q_2 = CV_1 + CV_2 = C(V_1 + V_2)
\]
The final common potential difference across the parallel combination is \(V_{final} = \frac{Q_{total}}{C_{total}}\):
\[
V_{final} = \frac{C(V_1 + V_2)}{2C} = \frac{V_1 + V_2}{2}
\]
Now, calculate the final energy stored in the combined system:
\[
U_{final} = \frac{1}{2}C_{total}V_{final}^2 = \frac{1}{2}(2C)\left(\frac{V_1 + V_2}{2}\right)^2
\]
\[
U_{final} = C \frac{(V_1 + V_2)^2}{4} = \frac{C}{4}(V_1^2 + 2V_1V_2 + V_2^2)
\]
Step 3: Calculate the decrease in potential energy.
The decrease in potential energy is the difference between the initial and final energies:
\[
\Delta U = U_{initial} - U_{final}
\]
\[
\Delta U = \frac{1}{2}C(V_1^2 + V_2^2) - \frac{C}{4}(V_1^2 + 2V_1V_2 + V_2^2)
\]
To subtract, find a common denominator, which is 4:
\[
\Delta U = \frac{2C}{4}(V_1^2 + V_2^2) - \frac{C}{4}(V_1^2 + 2V_1V_2 + V_2^2)
\]
Factor out \(\frac{C}{4}\):
\[
\Delta U = \frac{C}{4} [2(V_1^2 + V_2^2) - (V_1^2 + 2V_1V_2 + V_2^2)]
\]
\[
\Delta U = \frac{C}{4} [2V_1^2 + 2V_2^2 - V_1^2 - 2V_1V_2 - V_2^2]
\]
Combine like terms:
\[
\Delta U = \frac{C}{4} [V_1^2 - 2V_1V_2 + V_2^2]
\]
Recognize the perfect square identity \((V_1 - V_2)^2 = V_1^2 - 2V_1V_2 + V_2^2\):
\[
\Delta U = \frac{C}{4}(V_1 - V_2)^2
\]
The final answer is $\boxed{\frac{C}{4}(V_1 - V_2)^2}$.