I'm wondering whether there's an abstraction that unifies the special cases of dual or complementary equations of the form $A - B$ and $A + B$ that I've seen in math.
Here are some examples:
1: Even and Odd Parts of Functions
If $A = f(x)$ and $B = f(-x)$ then $\frac{A + B}{2}$ is the even part of $f$ and $\frac{A - B}{2}$ is the odd part of $f$.
For instance if $f(x) = e^x$ then $\frac{f(x) + f(-x)}{2} = \cosh x$ and $\frac{f(x) - f(-x)}{2} = \sinh x$.
2: Real and Imaginary Parts of Complex Numbers
If $A$ and $B$ are conjugate complex numbers, then $\frac{A + B}{2}$ is the real part of $A$ and $\frac{A - B}{2 i}$ is the imaginary part of $A$.
3: Lagrangian and Hamiltonian
This example is from physics, but I'm posting on this stackexchange (not physics) because I'm looking for a mathematical answer.
In classical mechanics, two useful formulations are the Lagrangian and the Hamiltonian.
The Lagrangian of a given system is the kinetic energy of the system minus the potential energy, $L = T - V$.
The Hamiltonian is the kinetic energy plus the potential energy, $H = T + V$.
So I'm wondering if anybody knows of any unifying abstractions of which some of the above are special cases. Or if anybody has more diverse examples of dualities between $A - B$ and $A + B$ to add, please comment.
I don't know if this is general enough but if you take an abelian group such that the square roots exist (that is for any $a\in G$ there is $b\in G$ such that $b^2=a$) and an automorphism $h$ such that $h^2(g)=g$, then any element $g\in G$ can be expressed as $g=AB$ where $h(A)=A$ and $h(B)=B^{-1}$, this can be proven by taking $b^2=g$ and letting $A=b\,h(b)$ and $B=b\,h(b)^{-1}$. All the examples above (except for the third one which i assume is just a coincidence) can be explained by this.