I read a brief article about Prolog and Logic Programming. I\'m curious if Logic Programs can do algebra. Like would you be able to ask what the Variable of X is in the equa
Yes, Prolog can do algebra.
If you Google for Prolog and CAS (Computer algebra system) you will get lots of results.
e.g. Using Prolog as a CAS
If you understand that Prolog = Syntactic unification + backward-chaining + REPL,
then realize that it is the unification that is the heart of solving the problems/equations, you may run into equational reasoning which is used for solving problems that contain equals (=). This same logic is also used with automated theorem provers and proof assistants.
If you look here you will find prolog.ml which implements the unification and backward-chaining in this automated theorem prover.
You should also check out term rewriting and search Google for term rewriting to learn more about the science of solving equations using terms.