What is algebra and who invented it?

Algebra is the study of variables and the rules for manipulating these variables in formulas.
The word algebra(in Arabic al-jabr) comes from the title of the early 9th century book ʿIlm al-jabr wa l-muqābala "The Science of Restoring and Balancing" by the Persian mathematician and astronomer al-Khwarizmi. He used the term al-jabr for the operation of moving a term from one side of an equation to the other.
here is a basic algebra equation:
2 + x = 4
by moving 2 to the other side of the equation we will have:
x = 4 - 2
x = 2