SolveFromImage How It Works
Technology

From Photo to Solution:
The Full Pipeline

Every time you upload an image, five distinct systems work in sequence — image preprocessing, OCR, problem classification, symbolic solving, and step generation. Here’s exactly what happens and why.

The Five-Stage Pipeline

Each stage hands off to the next. A failure at any point triggers a fallback rather than a wrong answer.

01Image Prep

Image Preprocessing

Before any text recognition begins, the raw image is normalized. This involves deskewing (rotating the image to align text horizontally), contrast enhancement to separate ink from paper, noise reduction for photographed pages, and resolution upscaling for images below the minimum threshold.

The preprocessing layer also segments the image into regions — separating text areas from diagrams, tables, and whitespace. This segmentation determines which recognition model handles each region downstream.

Operations applied
Deskew Binarize Denoise Upscale Region segmentation Contrast normalize
02OCR

Mathematical OCR

Standard OCR engines are trained on prose text — they struggle with fraction bars, exponent placement, radical signs, and Greek symbols. This stage uses a recognition model trained specifically on mathematical notation, including handwritten expressions.

The output is not plain text but a structured tree representation — an Abstract Syntax Tree (AST) — where each node is an operator or operand with correct spatial relationships preserved. This matters because “x²” and “x2” are visually similar but mathematically different.

AST output example
// 3x² − 7x + 2 = 0 { type: “equation”, lhs: { op: “sum”, terms: [ {coef: 3, var:“x”, exp: 2}, {coef:-7, var:“x”, exp: 1}, {coef: 2} ] }, rhs: 0 }
03Classify

Problem Classification

The AST is analyzed to determine which problem category and solving method applies. A quadratic equation triggers the discriminant-based solver. A derivative expression routes to the calculus engine. A word problem containing distance/time/rate keywords is parsed differently than one containing concentration and volume.

Classification also determines how the solution output should be structured — what counts as a meaningful “step” varies significantly between a system of linear equations and a chemistry balancing problem.

Classifier routing
ax²+bx+c=0 Quadratic solver
d/dx f(x) Calculus engine
F = ma Physics solver
C₆H₁₂O₆ + O₂ Chem balancer
04Solve

Symbolic Computation

The classified problem is passed to a symbolic math engine — not a numerical approximation, but an exact algebraic solver. This distinction matters: a numerical solver might return x ≈ 0.333 where the correct answer is x = 1/3. Exact symbolic results are more useful for learning because they match the form expected in classroom contexts.

Each operation is logged with its inputs and outputs, creating the raw material for the step-by-step explanation generated in the final stage.

Symbolic vs numerical
NUMERICAL ✗
x ≈ 0.33333…
SYMBOLIC ✓
x = 1/3 (exact)
05Explain

Step Generation

The operation log from Stage 4 is transformed into a human-readable explanation. Each step is labeled with the technique applied, and an annotation explains why that technique is appropriate at that point — not just what was done, but the reasoning behind the choice.

The output format mirrors what a teacher would write on a whiteboard: the expression before the operation, the operation name, and the resulting expression. This format is deliberately aligned with how instructors expect students to present their work.

Output structure
STEP 1 — Identify
Standard form ax²+bx+c = 0
STEP 2 — Apply
Quadratic formula: x = (−b ± √Δ) / 2a
STEP 3–5
Full solution + verification…
Performance

Recognition Accuracy by Input Type

Accuracy varies by image quality and problem type. These figures reflect clear, in-focus images.

Printed textbook (digital scan)98%
Screenshot (digital PDF)97%
Printed textbook (phone photo)92%
Clear handwriting on white paper87%
Casual handwriting, graph paper71%
💡

Lighting matters most

Even slight shadows across notation reduce accuracy. Natural daylight or a desk lamp positioned above the page gives the best results.

📐

Shoot directly overhead

An angle of 15° or more introduces perspective distortion that the deskew algorithm has to correct. Overhead shots need minimal correction.

✏️

Print, don’t cursive

Mathematical notation should be printed clearly. Cursive numerals and connected variables are the most common source of handwriting misreads.

Why Standard OCR Fails on Math

Most optical character recognition systems are trained on books, documents, and web pages — text that flows left to right in sentences. Mathematical notation breaks every assumption built into those systems. Fractions place characters vertically. Exponents appear above the baseline. Radicals span multiple characters horizontally. Integral signs and summation symbols have operands both above and below.

A prose OCR engine might read “x²” as “x2” and “√(x+1)” as an unintelligible string. These aren’t minor errors — they completely change the mathematical meaning and will produce wrong solutions if passed to a solver directly.

The recognition model used here was trained on a dataset of mathematical expressions specifically, including both typeset (LaTeX-rendered) and handwritten samples. The output of this model is not a string of characters but a structured representation — which means the spatial relationships between characters are preserved, not discarded.

Symbolic vs. Numerical Solving

There are two broad approaches to computational mathematics: numerical methods and symbolic methods. Numerical methods approximate answers iteratively — they’re fast and work for almost any function, but they return decimal approximations, and they don’t show algebraic reasoning. Symbolic methods manipulate expressions algebraically, preserving exact forms like fractions, square roots, and variables.

For a homework solver, symbolic output is far more useful. When a student solves 3x² − 7x + 2 = 0 and gets x = 0.333, they have to know to recognize that as 1/3 — which is a non-trivial step when they’re already confused by the problem. A symbolic result of x = 1/3 maps directly to what the textbook and teacher expect.

The trade-off is complexity: symbolic solvers require significantly more computational overhead and don’t generalize as easily to every function type. The system uses a hybrid approach — symbolic solving for the problem types where exact form matters (algebra, calculus), numerical verification as a sanity check, and a fallback explanation when a problem falls outside the exact-solver’s scope.

How Word Problems Are Handled

A photograph of “A train travels at 80 km/h for 2.5 hours. How far does it travel?” contains no equation — just text. The word problem parser has to identify the relevant quantities (speed, time), recognize the relationship type (kinematics, distance = speed × time), construct the equation, and then pass it to the solver.

This is a substantially different problem from reading a written equation. The parser uses pattern matching against common problem structures — rate × time = distance, work = force × displacement, PV = nRT — to identify the template, then extracts numerical values from the text to populate it.

Word problems with unusual phrasing or multi-step dependencies (where the output of one equation feeds into another) are more challenging. The system handles two-step word problems reliably; longer chains may require the user to break the problem into parts.

What Happens When Recognition Fails

The pipeline includes confidence scoring at the OCR stage. If the recognized expression falls below the confidence threshold, the system does not silently proceed to the solver — it surfaces the low-confidence detection to the user so they can verify it before solving. This prevents the common failure mode of getting a wrong answer with no indication that the problem was misread.

The detected problem is always shown explicitly before the solution steps. Checking this display against the original image takes two seconds and catches the majority of recognition errors before they propagate through the rest of the pipeline.

See It Work on Your Problem

Upload an image — the full pipeline runs in seconds.

Get Step-by-Step Solution →
Scroll to Top