NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Towards Automatic Mathematical Exercise Solving

Tianyu Zhao, Chengliang Chai, Yuyu Luo, Jianhua Feng, Yan Huang, Songfan Yang, Haitao Yuan, Haoda Li, Kaiyu Li, Fu Zhu, Kang Pan

Abstract

Researchers have developed MathGraph, a specialized knowledge graph designed to solve high school mathematical exercises automatically. Unlike traditional knowledge graphs that store static facts, MathGraph models mathematical objects, operations, and constraints to perform multi-step derivations and symbolic calculations. This approach allows the system to outperform traditional rule-based solvers by approximately 20% on complex problems.

Introduction

While general-purpose knowledge graphs (KGs) like Freebase or DBpedia are highly effective at answering factual queries (e.g., "Who is the President of France?"), they are ill-equipped for mathematical reasoning (e.g., "Find the modulus of $z = (i+1)(i-3)$"). The authors identify three core challenges that distinguish mathematical knowledge from general semantic data:

  1. Domain Specificity: Mathematical knowledge is dense and lacks the massive, semi-structured semantic data used to build general KGs.
  2. Class vs. Instance: Traditional KGs link specific instances. In math, facts are abstract classes (e.g., properties of an ellipse), while instances only exist within the context of a specific exercise.
  3. Derivation vs. Retrieval: Solving math requires simultaneous logical derivation and numerical calculation rather than simple fact retrieval.

The MathGraph Framework

Graph Structure

MathGraph is built upon three primary node types that represent the building blocks of mathematical reasoning:

  • Object Nodes: Represent abstract entities (e.g., "Triangle") and their key properties (sides, angles).
  • Operation Nodes: Represent functions (e.g., "Get Real Part") that take objects as inputs and produce new ones.
  • Constraint Nodes: Represent relationships (e.g., "x and y are a conjugate pair") that can be converted into solvable equations.
The MathGraph schema defines object, operation, and constraint nodes connected by flow edges.

These nodes are connected by Flow Edges, showing data movement between operations, and Derive Edges, representing "is-a" relationships. For example, a "Triangle" node can be upgraded to an "Isosceles Triangle" node if constraints reveal two equal sides, instantly unlocking new theorems.

Hybrid Construction

To build the graph, the authors employed a hybrid approach. Crowdsourcing was used to extract entities and relationships from thousands of exercises, achieving high recall. However, because math requires strict logic, experts were brought in to code the underlying symbolic logic and functions for each node, ensuring precision.

The Solver Pipeline

When a mathematical exercise is presented, the system processes it through a multi-stage pipeline to arrive at a solution:

  1. Semantic Parsing: A parser maps the natural language text of the exercise to specific MathGraph nodes.
  2. Dependency Analysis: The system builds a Directed Acyclic Graph (DAG) of uncertain instances and constraints.
  3. Symbolic Execution: Using libraries like SymPy, the system solves the resulting system of equations and constraints to produce the final answer.
The complete pipeline from original exercise text to the final answer via the MathGraph solver.

Evaluation and Results

The system was evaluated on four datasets of Chinese high school mathematical exercises: Complex Numbers (1,526 exercises), Triangles (782), Conic Sections (1,196), and Solid Geometry (653). Exercises were categorized by difficulty into Easy, Medium, and Hard.

Key Findings

  • Accuracy Boost: MathGraph consistently outperformed rule-based baselines. The advantage was most pronounced in "Medium" and "Hard" problems, where MathGraph's multi-step derivation capabilities provided a ~20% accuracy edge.
  • Robustness: While all systems struggle as difficulty increases, MathGraph's performance decayed much more slowly than traditional solvers, proving its robustness in complex scenarios.
  • Cost-Effectiveness: The crowdsourcing approach allowed the construction of a comprehensive graph (89 objects, 723 operations, 875 constraints) for approximately $2,200 USD, significantly less than a purely expert-led build.

Limitations and Future Work

Despite its success, the system faces a parsing bottleneck. If the rule-based semantic parser fails to map natural language to the graph correctly, the solver cannot proceed. Future research may involve deep learning-based parsers to improve flexibility. Additionally, expanding the system to higher-level calculus would require more complex operation nodes and further expert coding to automate symbolic function generation.

Summary updated

BibTeX
@article{zhao2019towards,
  author = {Tianyu Zhao and Chengliang Chai and Yuyu Luo and Jianhua Feng and Yan Huang and Songfan Yang and Haitao Yuan and Haoda Li and Kaiyu Li and Fu Zhu and Kang Pan},
  title = {{Towards Automatic Mathematical Exercise Solving}},
  journal = {Data Sci. Eng.},
  year = {2019},
  doi = {10.1007/s41019-019-00098-w},
}
Figure