AI Math Tutor

Blog · Scanning homework

Math OCR Explained: How an App Reads a Photo of a Problem

Math OCR is the step between your photo and the solution that nobody sees and everybody depends on. OCR, optical character recognition, turns a picture of characters into typed characters. For an ordinary sentence that is a mature and reliable job. For math it is harder, because a math problem is not a line of text. It has a fraction bar with a number above and one below, a small 2 floating at the top right of an xx, a root sign whose roof covers some terms and not others.

This post explains what math OCR does, how a vision model reads the same photo differently, why fractions, exponents, radicals and subscripts are the usual trouble spots, and how to check a read before you trust the steps, with two worked examples where the read changes the answer.

Key takeaways

What plain text OCR does with a photo of math

An OCR service works in stages. It finds the regions of the image that contain writing, splits those regions into lines, splits the lines into individual shapes, and decides which character each shape most resembles. Then it strings the characters together in reading order, left to right, and hands back typed text.

That reading order is the catch. A sentence is a single row of characters, so left to right captures everything. A math expression is two-dimensional. The numerator of a fraction sits above the denominator, an exponent sits above and to the right of its base, a subscript sits below and to the right, and a radical's roof stretches over a group of terms. A left-to-right reader has to decide what to do with characters that are not on the line, and the simplest thing it can do is drop them onto the line. That is how 34\frac{3}{4} can become 34 and x2x^2 can become x2x2.

Many photo solvers send every photo down this path. AI Math Tutor does not: an AI vision model reads the photo, for everyone, free or Pro, as the next section explains. The trouble spots are still worth knowing, because they are the same places any reader is most likely to slip.

You may have seen the phrase "LaTeX OCR" for tools that turn an image of an equation into LaTeX code for typesetting. That is a related job with a different goal: producing a document rather than a solution. The editable text on the app's "Here's what I read" screen is the typed problem the tutor is about to solve, and the thing to do with it is read it.

How a vision model reads the same photo

A vision model does not produce text first. It takes the image as a whole and reasons about what is in it, the way it would describe any picture. That means it can use the layout: the bar between two numbers is a fraction because of where it sits, the small 2 is an exponent because it floats above the line, the numbers next to the sides of a triangle belong to those sides.

In AI Math Tutor the photo itself goes to an AI vision model, the same way for everyone, free or Pro, and the app asks permission before the first problem leaves the device. Because it is looking at the page rather than at a string pulled off the page, it reads printed and handwritten math and describes a labeled diagram in words. The app then shows what it read on a "Here's what I read" screen, as typeset math and as editable text, and nothing is solved until you tap "Looks right, solve it".

It is not magic and it can still misread a smudged 7 or a cramped exponent. Whichever reader an app uses, the habit is the same. Read what the app understood before you read what it did.

Why fractions, exponents, radicals and subscripts get misread

Each of the troublesome symbols breaks the one-line assumption in a slightly different way. The table lists the usual misread and the thing to look for in the read.

Symbol Common misread What to check
Fraction, 34\frac{3}{4} 34, or the bar read as a minus sign That a fraction is shown, and that the whole top and whole bottom stayed together
Exponent, x2x^2 x2x2, or the 2 read as a separate term That the 2 is raised, written with a caret as x^2
Radical, 16+9\sqrt{16 + 9} The root over only the first term, or the sign dropped Exactly what the root covers
Subscript, a1a_1 a1a1, treated as aa times 1 That the 1 is a label, not a factor
Minus sign Dropped, or read as a dash or underscore The sign in front of every term
Look-alikes: xx and ×\times, ll and 1, OO and 0 One swapped for the other Whether each shape should be a letter, a digit or an operation
Parentheses Dropped or unbalanced That every open parenthesis has a partner

Handwriting makes all of these worse, because a short fraction bar and a minus sign are the same stroke, and a lazy exponent drifts down to the line. Handwritten Equation Solver: How to Scan Your Own Writing shows how to write so these do not happen. Screenshots make them better, because the characters are rendered crisply and nothing is tilted, which is the point of Screenshot Solver: Solve a Math Problem From a Screenshot.

How to check the read

Take it in this order, because it takes ten seconds and saves a wrong solution.

Count the terms. If the page has four terms and the read has three, something was dropped or merged. Then check every sign, since a dropped minus is invisible until the answer comes out wrong. Then check every fraction bar, exponent and root: is each one still there, and does it cover the right pieces? Finally check the letters, so that an xx has not become a multiplication sign and a 1 has not become an ll.

If any of it is wrong, do not confirm it. The read is editable on that screen, so fix the text there, for example "x/3" instead of "x3", then tap "Looks right, solve it". Retaking the photo with more light and a tighter frame, or typing the problem, also works. When the read is right, read the steps and check the answer by substituting it back, the routine covered in App That Scans Homework: How Photo Math Solvers Work.

Worked examples

Both examples show a correct read, the steps, and then what the answer would have been under the common misread, so you can see why the check matters.

Example 1: solve x3+5=9\frac{x}{3} + 5 = 9

The photo shows one printed worksheet line with a clear horizontal fraction bar, taken flat in daylight with nothing else in the frame.

What the app read: x3+5=9\frac{x}{3} + 5 = 9

  1. Subtract 5 from both sides to leave the fraction alone on the left.
    x3=4\frac{x}{3} = 4
  2. Multiply both sides by 3 to undo the division and get xx by itself.
    x=12x = 12

So x=12x = 12. Check it by substituting: 123+5=4+5=9\frac{12}{3} + 5 = 4 + 5 = 9, which matches.

Now the misread. If the fraction had flattened to x3+5=9x3 + 5 = 9 and you confirmed it, the tutor would treat that as 3x+5=93x + 5 = 9 and solve it correctly to x=43x = \frac{4}{3}. Every step would be right and the answer would be wrong, because the problem was wrong. The only place to catch that is the read screen, before you confirm.

Example 2: evaluate 16+9\sqrt{16 + 9}

The photo shows a printed expression in which the roof of the root sign clearly stretches over both numbers, taken straight on with the flash off.

What the app read: 16+9\sqrt{16 + 9}

  1. Work inside the root first, because the roof groups everything under it, like a pair of parentheses.
    16+9=2516 + 9 = 25
  2. Take the square root of the result.
    25=5\sqrt{25} = 5

So 16+9=5\sqrt{16 + 9} = 5. Check it by squaring: 52=255^2 = 25, and 2525 is what was under the root.

Now the misread. If the read had put the root over 16 alone, the problem becomes 16+9=4+9=13\sqrt{16} + 9 = 4 + 9 = 13. Again every step would be right for the wrong problem. When an answer looks off, look at the read before you look at the steps.

Common mistakes

The habit carries over to the simplest problems too, which is why Scan Calculator: Point the Camera and Get Arithmetic Right starts with the same check. Photograph the next problem you are unsure about, check what it read, and follow every step in AI Math Tutor.

AI Math Tutor is a study aid, not a substitute for a teacher, and it can make mistakes: check every step, not just the answer.

Questions

What is math OCR?

OCR stands for optical character recognition: software that turns a picture of characters into typed characters. Math OCR is the same job applied to a math problem, which is harder because math has structure above and below the line, such as fraction bars, exponents, radicals and subscripts, that a left-to-right reader can flatten or lose.

Is a vision model the same as OCR?

No. OCR produces text first and a solver works on that text. A vision model looks at the image directly and reasons about what it sees, including the layout of the page. In AI Math Tutor an AI vision model reads the photo, the same way for everyone, free or Pro, and the app shows what it read before anything is solved.

Why did the app read my fraction as one number?

A fraction bar is a horizontal line with a number above and below. A text reader that scans left to right can see the two numbers as neighbors and merge them, turning 34\frac{3}{4} into 34. Any reader slips more often on a short, cramped bar. A longer, clearer bar and more space between fractions makes this less likely, and the Here's what I read screen is where you catch it and fix it.

Can I fix the read in the app?

Yes. The Here's what I read screen shows the problem as editable text, so fix it there, for example changing x3+5=9x3 + 5 = 9 to x3+5=9\frac{x}{3} + 5 = 9 by typing x/3, then tap Looks right, solve it. Retaking the photo or typing the problem also still work, and nothing is solved until you confirm.

Read next