How artificial intelligence works when reading handwritten mathematics starts with a fraction written in a student’s notebook. A student draws 3 above a horizontal bar and 4 underneath it. A basic text recogniser might read the characters in the order 3, a dash and 4, producing ‘3-4’. But the student’s intended expression is three quarters. The difference is not the characters alone: their two-dimensional arrangement tells us which mathematical operation is present.
Did you know that a small raised 2 can mean an exponent, while a lowered 2 can mean a subscript? A fraction bar, minus sign, square-root bar and underline can also resemble one another in a blurry photograph. Reading handwritten mathematical expressions requires locating individual symbols and recovering the relationships among them. Research benchmarks such as CROHME evaluate this task because it is distinct from ordinary line-by-line handwriting recognition.
The useful route is worksheet image → identify mathematical regions → detect or encode handwritten strokes → recognise candidate symbols → infer two-dimensional structure → translate to a structured expression such as LaTeX or MathML → verify grouping, operators and signs against the original → only then evaluate the mathematics. AI helps recover structure, but a plausible formula is not proof that the student’s marks were read correctly.
The five-question reading route
- Which image region contains the expression?
- What symbols can be observed?
- Where are fraction bars, roots and superscripts attached?
- Does the rendered expression match the handwriting?
- Which details remain uncertain and need review?
1. Why mathematics cannot be read as a plain sentence
An ordinary English sentence is usually read in a sequence along lines. Mathematics can place one symbol above another, inside a radical, beneath a limit, as an exponent or in a nested fraction. The visual relationship between symbols may be more important than their alphabetical order.
Consider 3 over 4, compared with 3 minus 4. The same two numerals and a horizontal stroke appear in both, but their placements define very different operations and answers. A text recogniser that outputs a simple list of characters without structure has not yet interpreted the mathematics.
The task therefore includes symbol recognition and spatial parsing. Good systems treat those as separate sources of possible error so a reviewer can see whether a wrong result came from a misread digit or a misplaced fraction relationship.
2. What is handwritten mathematical expression recognition?
Handwritten mathematical expression recognition, often abbreviated HMER, attempts to convert handwritten mathematical notation into a structured digital representation. Its input may be a static photograph or a sequence of pen strokes from a digital tablet.
The output might be LaTeX, MathML or another expression tree that preserves fractions, powers, roots and other structures. Unlike a plain OCR transcript, the output must show which symbols are grouped together and how their visual relationships correspond to mathematical syntax.
CROHME’s organisers describe it as a longstanding international challenge for recognition of handwritten expressions. That research programme includes online and offline modalities, reflecting the fact that pen movement sequences provide different evidence from completed page images.
3. Offline images and online pen trajectories are different
A phone photograph is an offline image: the computer sees pixels showing the completed strokes, but it does not know the order in which they were written. A pen tablet can record an online trajectory of positions and sometimes timing as the student writes.
Online data may help separate connected strokes or track symbols that overlap. However, even with a pen sequence, the system must still recover two-dimensional mathematical structure. A student may write the fraction bar before its numerator or add an exponent after other symbols.
Benchmark results from an online recognition task should not be presented as guarantees for photographs. The available evidence differs, so the methods and performance limits can differ as well.
4. First locate the expression region
A worksheet may include printed questions, handwritten working, diagrams and a student’s corrections. A model needs to identify which region contains the mathematical expression to be read. Cropping too tightly can remove an exponent; cropping too broadly can bring in an unrelated annotation.
Layout detectors can propose equation regions, while segmentation can distinguish printed text from added handwriting. A larger page-processing system may attach each mathematical region to the corresponding question.
That association matters: a perfectly parsed equation assigned to the wrong question can still lead to wrong feedback. Preserve the original region coordinates and question mapping before performing any mathematical interpretation.
5. How individual symbols become candidates
A recognition stage estimates whether small strokes form digits, letters, operators, parentheses or special mathematical signs. The digit 1 can resemble a lowercase l; a handwritten 5 may resemble an S; and a slanted multiplication sign can resemble the letter x.
Recognition relies on shape, context and training examples. A language-aware model can sometimes prefer a common expression, but that preference is not direct evidence about a faint stroke. A student may legitimately use an unusual variable or make a mathematical mistake.
The system should not silently correct the student’s work to a likely right answer. Accurate transcription must allow an incorrect expression to remain incorrect when that is what the source visibly shows.
6. A fraction bar is a relationship, not just a dash
In a fraction, the horizontal bar divides a numerator region from a denominator region. The parser needs to identify the bar and gather the symbols above and below into two groups. Those groups can themselves contain operators or other fractions.
A simple line detector may find a bar without recognising its role. The same page may contain a minus sign, an underscore in a label or a line drawn under a working step. Geometric context and symbol grouping are essential.
A robust representation can encode the fraction as a tree with numerator and denominator children. That makes later rendering and arithmetic clearer than a flat character string containing a dash.
7. A complete fictional fraction example
Imagine a student writes a large 3 above a horizontal line and a 4 below. The system recognises the two digits and identifies the middle line as a fraction bar spanning their region. It constructs the expression three quarters rather than the subtraction expression 3 minus 4.
Now the student writes 1 plus 2 above the bar and 3 underneath. If the bar spans the entire 1 plus 2, the numerator is grouped as a sum, not merely the digit 2. The relationship must be inferred from the full horizontal extent and alignment.
These expressions are invented teaching examples. They are not measured CROHME samples or claims of exact performance on a specific student’s handwriting.
8. Superscripts change powers and meaning
A raised 2 placed to the upper right of x conventionally expresses x squared. The same 2 on the baseline after x can instead be another token, and a lowered 2 can be a subscript in other mathematical or scientific notation.
The system must identify a symbol’s position relative to its base and the surrounding writing line. An exponent can extend to several symbols, such as x raised to a grouped expression. Correct association requires more than simply noting that one digit is small.
Errors are consequential. Reading x squared as 2x changes the function and all subsequent calculations. Human review should focus on raised and lowered symbols in difficult scans because a small positional error can reverse the mathematical structure.
9. Square roots also express nested structure
The radical symbol has a shape and an overbar covering the expression to which it applies. If a bar covers 9 plus 7, the expression differs from a square root of 9 followed by plus 7 outside the radical.
Handwritten overbars may be short, long, slanted or incomplete. A model must infer their intended coverage from the image and mathematical layout, and should not rely only on common algebra patterns.
A structured expression tree makes the chosen grouping inspectable. If the image is too ambiguous to distinguish the two cases, an honest answer can report the uncertain extent rather than force one polished LaTeX expression.
10. Subscripts are not superscripts
Scientific and mathematical writing uses subscripts in variable names, sequences and chemical formulas. A small 2 below and to the right of a base character does not mean the same thing as an exponent 2 above it.
Some students write small indices very close to the baseline or slant the entire expression. An isolated character recogniser can get the digit right while attaching it to the wrong spatial role.
Research on HMER repeatedly finds that recognising symbols and recognising their structure are distinct difficulties. A proper evaluation should count symbol errors and structural attachment errors separately.
11. The role of an expression tree
A mathematical expression can be represented as a hierarchy: an operator has operands, a fraction has numerator and denominator, and a power has a base and exponent. These relationships can be stored in an expression tree or graph.
Converting the image into a tree enables later operations such as typesetting, checking algebraic structure or evaluating a result. It also allows a reviewer to identify exactly where a fraction grouping or exponent association went wrong.
Graph-to-Graph research in handwritten expression recognition models symbol segmentation and relations explicitly, illustrating one approach to preserving mathematical relationships rather than relying entirely on a flat character sequence.
| Source arrangement | Meaning | Common false reading |
|---|---|---|
| 3 over bar over 4 | Fraction three quarters | Subtraction 3−4 |
| x with raised 2 | x squared | 2 times x |
| a with lowered 2 | Subscripted variable | a squared |
| Radical bar over 9+7 | Square root of grouped sum | Square root of 9 then +7 |
| Long horizontal stroke through word | Possibly cancellation | Fraction bar |
| Small dot after digit | Decimal punctuation | Dust ignored or added |
12. Why LaTeX is an output notation, not a proof
LaTeX can represent fractions and powers with explicit structure, making it convenient for exporting mathematical expressions. But the fact that an AI system produces valid LaTeX does not show that it correctly interpreted the handwriting.
An expression can be beautifully typeset and still contain the wrong minus sign or denominator. A language model may also produce a syntactically plausible expression that corrects what it thinks the student intended rather than transcribing what was written.
Keep the source image and compare the rendered output with it. Correct typesetting and faithful recognition are different quality measures.
13. Nested fractions multiply the difficulty
Some expressions contain a fraction inside a numerator or denominator. The parser must decide which bar is the outer fraction and how the inner terms are grouped. Two horizontal strokes at different heights can easily be confused.
A simple left-to-right reader may misorder symbols from different levels of the hierarchy. An image-to-markup model can learn spatial patterns, but it still needs enough resolution to distinguish the bars and the symbols each covers.
A useful review displays each inferred fraction’s numerator and denominator groups. When those boundaries overlap ambiguously, the model should ask for clarification rather than invent a unique parse.
14. Crossed-out workings add another layer
Students may cross out a denominator, simplify a fraction or strike through an incorrect calculation. Those marks are visually similar to mathematical bars and operators, but their meaning is editorial rather than algebraic.
A system should represent original strokes, cancellations and replacements separately from the final mathematical expression. Otherwise it might interpret a cancellation line as division or merge old and new numbers into one formula.
This matters for teaching as well as accuracy. A learner’s corrections can show how understanding developed. Automatically removing them can produce a neat answer while hiding the sequence of reasoning.
15. Contextual language models can help and mislead
A model may use surrounding mathematical notation to resolve an ambiguous symbol. For example, the shape of the following operator or the expected structure of a fraction may make one candidate more plausible than another.
However, students are allowed to write incorrect equations. The model should not alter a visible minus to a plus simply because the plus version would solve the problem. Correcting reasoning is a separate tutoring task from recognising the original marks.
The best workflow can offer both a faithful candidate transcription and optional feedback, clearly labelled. It never presents a guessed mathematically correct expression as an observed student answer.
16. CROHME gives a concrete evaluation framework
The CROHME competition and datasets provide handwritten mathematical expressions with ground-truth structure. The organiser’s site documents competition editions and the distinction between online trajectories and offline recognition.
The 2023 CROHME dataset includes online, offline and bimodal tasks, with structured ground truth. This research shows why mathematical OCR needs evaluation on expressions rather than only isolated characters.
Benchmark results depend on the exact data split, modalities and scoring rule. High accuracy for one dataset does not imply that a tool can read every low-resolution photograph of a child’s worksheet without error.
17. Realistic writing exposes structural weaknesses
Research reported at ICML 2026 introduced a real-world HMER benchmark focusing on structurally complex expressions. It found that large models may recognise local symbols while making mistakes in the relationships among them, particularly as structural complexity increases.
That distinction is highly relevant for school mathematics. An expression containing a fraction, radical and superscript can fail even when most individual digits are readable.
Model evaluation should therefore test two-dimensional relationships deliberately: base-to-exponent, fraction numerator-to-denominator, radical coverage and parentheses grouping. A single overall token score can conceal these failures.
18. A practical validation checklist
Check that the equation region is complete, symbols are recognised, every fraction bar has the right numerator and denominator, powers are attached to the right bases, and crossing strokes are not treated as operators.
Next compare the rendered expression with the source image rather than checking only whether the mathematics is solvable. A valid expression can still be the wrong transcription.
If the result will affect marks, a teacher should be able to inspect the original page and override the AI. A system that exposes uncertainty supports fairer feedback than one that always returns a confident formula.
| Failure | What changes | Useful check |
|---|---|---|
| Correct digits, wrong fraction grouping | Entire expression meaning | Compare bar coverage |
| Raised exponent attached to wrong base | Power applies to wrong term | Inspect spatial hierarchy |
| Minus interpreted as fraction bar | Operation changes | Review positions and neighbours |
| Scribble treated as operator | Cancelled work becomes current | Preserve correction layer |
| Answer automatically fixed | Student’s actual work lost | Separate transcription from tutoring |
| Valid LaTeX but wrong content | Polished misinformation | Render beside source |
19. Evaluate character and expression accuracy separately
A model might recognise nine out of ten symbols correctly but still change the entire expression when the wrong character is a minus sign or a fraction boundary. Overall symbol accuracy therefore does not reveal the practical severity of an error.
Expression-level accuracy checks whether the whole mathematical structure matches a verified reference. Additional tests can examine particular relations, such as superscript attachment and fraction grouping.
Include handwriting from different writers, pen types, background conditions and mathematical levels. Avoid using nearly identical images across training and testing, because that would inflate apparent generalisation.
20. What about printed and handwritten text together?
A worksheet can show the printed instruction ‘Simplify’ above a handwritten nested fraction. The extractor must distinguish the question from the student’s response and keep their spatial relationship.
A handwriting recogniser should not claim the printed example is student working. Conversely, a general OCR model should not ignore a handwritten exponent merely because the printed portion dominates the image.
This division of tasks connects mathematical expression recognition with document-layout analysis. Source role and expression structure must both survive the conversion.
21. A safe paper experiment
Write three original expressions: a simple fraction, a variable with an exponent and a square root covering a sum. Next write visually similar alternatives that change only the placement or extent of a bar or raised digit.
Ask another learner to identify the exact change in meaning. Then photograph the expressions at a slight angle and compare whether their structure is still obvious. A paper exercise can expose the important reasoning problem without needing a neural model.
For a digital extension, test a properly authorised math OCR tool on original notes. Keep the source images and check rendered formulas character by character rather than accepting whatever algebraic result appears.
22. Privacy and fair treatment of student work
Mathematics worksheets may contain names, grades and other student information. Processing should occur through authorised systems with appropriate retention and access controls.
The student may have written a mathematically wrong expression. A transcription tool should preserve it faithfully rather than correct it silently, because the teacher’s feedback depends on the actual working.
The system should distinguish ‘unreadable’, ‘probably this symbol’ and ‘verified by reviewer’. Those states make it possible to use AI efficiently without treating uncertain pixels as definitive evidence about a learner’s ability.
23. Common misconceptions about math OCR
First, reading individual digits does not mean the expression was parsed correctly. Second, a fraction bar is not the same as a minus sign. Third, a superscript and a subscript can use the same glyph while having different meanings.
Fourth, syntactically valid LaTeX is not proof of faithful transcription. Fifth, a language model should not silently fix students’ errors. Sixth, online pen trajectories and offline photographs are different modalities.
The most useful question is which structured expression the student visibly wrote and what evidence supports that grouping. If the image cannot answer, the model should not pretend it can.
24. The bigger lesson: relationships carry mathematical meaning
Handwritten mathematical recognition illustrates why artificial intelligence must reason about spatial structure rather than only classify shapes. Numbers, bars and symbols form a hierarchy; changing their relationships changes the mathematics.
Vision models can identify strokes, structural decoders can propose expression trees and typesetting tools can render the result. Trust comes from showing the full chain and preserving the original handwriting.
The enduring principle is to read what is present before solving it. AI helps students and tutors most when it keeps measurement, recognition, structure and mathematical interpretation separate.
Frequently asked questions
What is handwritten mathematical expression recognition?
Converting handwritten mathematical notation into a structured digital expression.
Why is it harder than ordinary OCR?
Fractions, exponents, subscripts and roots use two-dimensional relationships.
What is CROHME?
A long-running benchmark and competition for recognising handwritten mathematical expressions.
Can AI distinguish 3/4 from 3−4?
It can estimate the arrangement, but ambiguous handwriting needs checking.
Is an exponent just a small number?
No. The number’s position and base relationship define its role.
What is an expression tree?
A hierarchical representation linking operators to their operands and groups.
Does correct LaTeX prove a correct reading?
No. The expression may be syntactically valid yet differ from the handwriting.
What is online math recognition?
Recognition using recorded pen-stroke trajectories instead of only a completed image.
Should an AI fix incorrect student equations automatically?
Not when it is meant to transcribe faithfully; feedback should be separate.
What should a teacher check?
Symbols, grouping, source regions and uncertainty in consequential working.
Primary research and related teaching guides
- CROHME: Official Competition and Datasets
- ICDAR 2023 CROHME Datasets
- ACCV 2022: Handwritten Mathematical Expression Recognition
- ICML 2026: Seeing Symbols, Missing Structure
- AAAI 2021: Graph-to-Graph Mathematical Expression Recognition
- How AI Separates Handwritten Answers From Printed Worksheet Questions
- How AI Recognises Crossed-Out Text in Scanned Documents
- eduKateSG: How X Works Hub
Editorial note: All handwritten fractions, equations and student situations described here are invented instructional examples. CROHME and related studies describe methods and benchmarks, not guaranteed performance on every worksheet. Any generated notation must be compared with the original handwriting before grading or reporting results.