Artificial intelligence and mathematics don’t get along too well. Although advances in AI have served to create robots that assemble furniture, defeat one of Go’s best players on several occasions or search for infected human tissues, AI still has a way to **solve complex problems in which they intervene equations with symbols**. So much so that a DeepMind AI was not able to pass a test that consisted of adding 1 + 1 + 1 + 1 + 1 + 1 + 1, but now Facebook seems to have succeeded.

In an article available in arXiv ( PDF ), Guillaume Lample and François Charton, researchers at Facebook AI Research, have achieved that artificial intelligence **solves complex equations involving symbols, for example, y = 4x ^{2} -8x ^{6}**. They have done so by training a neural network to be able to integrate symbols and solve differential equations.

## Understand what’s behind the symbols

As anyone with basic math knowledge will know, **most equations are expressed using abbreviations**. “cos” is cosine, x ^{2} is x multiplied by x, and so on. The achievement of Facebook researchers AI Research has been to get AI to understand these abbreviations by making them more basic and building **expression trees**.

The researchers give the following examples. 2 + 3x (5 + 2) and 3x ^{2} + cos (2x) -1 can be expressed like this or can be simplified to make them simpler. According to the researchers, representing the tree-shaped formulas disambiguates the order of operations, eliminates the need to use parentheses and improves the compression of operations. In other words, **using this method the formulas become sequences, and that is easier to handle for an AI**.

These sequences are processed using a seq2seq model, which is the one used in automatic translation systems. With example it is understood much better. 2 + 3x (5 + 2) **are really three sequences**. Following the hierarchy of mathematics, first, add 5 + 2, then that is multiplied by three and then that is added 2. If the AI learns to identify those patterns, you can simplify the expressions and solve them.

With that clear, the model was ready to be trained. The researchers created a dataset with expressions of up to 15 internal nodes (15 branches), four binary operators (addition, subtraction, multiplication and division) and fifteen unary operators (exp, log, sin, cos, tan …). After filtering the results to eliminate any expression that could not be integrated, a dataset of **80 million first and second-degree differential equations** and 20 million expressions integrated by parts were achieved.

The AI learned to solve them, ergo learned to derive and integrate a complex mathematical expression. Finally, AI **was tested with 5,000 expressions** that I did not know and their results were compared with those obtained by Maple, Matlab and Mathematica, three software that anyone can use for the same purposes.

The results are that the model developed by Facebook researchers obtains an **accuracy close to 100% in tasks such as the integration of functions,** while Mathematica remains at 85%. In addition, the programs mentioned above fail to solve the equations after 30 seconds of calculation, while the neural network of Facebook usually finds a precise solution in **less than a second**, often discovering several solutions equivalent to the same problem.

Little by little, artificial intelligence is improving its performance in mathematics, and it seems that this **approach focused on simplifying the equations and making them “understandable” works. **In fact, a similar approach was followed by Google when at the beginning of the year it developed an AI capable of demonstrating more than 1,200 mathematical theorems. The milestone is not so much that AI knows mathematics, but that, in some way, it is capable of developing a kind of mathematical reasoning.