Inspiration: The most valuable part of solving a math problem is often invisible in the final answer: the diagram that made an idea click, a first attempt that failed, a hint used at the right moment, and the correction written afterward. Those pieces usually end up scattered across paper, screenshots, PDFs, and chat. Mathfolio grew from a question: what if an AI math assistant helped preserve the learner's reasoning instead of replacing it?

What it does:The workspace connects four activities that usually live in separate apps:

  1. Understand: ask for prerequisite concepts and reveal hints in stages, from a starting point to a worked solution. Follow up in chat and attach a sketch when words are not enough.
  2. Explore: construct geometry or graph equations, adjust parameters, and choose which illustrations are shared as AI context.
  3. Work independently: write notes, attach a solution image, and use Solo mode to focus on the problem and personal work.
  4. Return later: save the exercise with its notes and illustrations, organize it in colored folders, search and filter the library, and optionally sync saved work across devices. Appearance settings, study options, and a built-in guide make the workspace easier to adapt and learn. Our demo starts with an algebra challenge involving a real parameter:

$$ \log_{2}(x-1) + \log_{2}(a-x) = 1 $$

The learner must state the domain \(1<x<a\), classify when there are zero, one, or two real solutions, and find the parameter for which the two roots differ by exactly \(1\) (\(a=4\), giving \(x=2,3\)). This question comes from a six-page, eighteen-problem algebra workbook that also tests radicals, extraneous roots, rational inequalities, and parameter cases. We compare a local route with a Gemini cloud route on this same statement, ask why a positive discriminant is not enough, and save the learner's corrected reasoning. A separate geometry exercise then demonstrates the drawing tools; it is not part of the Local/Cloud algebra comparison. The demo shows each AI route's limits rather than treating either as an answer authority.

How we built it:

We built the frontend with React, TypeScript, and Vite. MathLive handles editable math input, KaTeX renders notation, PDF.js handles PDF pages, and Tesseract.js supports browser OCR. The app includes drawing and graphing tools and stores a working copy in IndexedDB so learners can keep working during a network interruption.

Firebase AI Logic is the AI bridge. In src/ai.ts, Mathfolio creates Gemini models through firebase/ai, uses configurable fast and deep routes for transcription, knowledge, hints, and chat, and requests on-device inference where the browser supports it. Cloud AI is an explicit choice with a consent step; only selected problem context is sent for that request. Firebase App Check protects the cloud app path. Firebase Authentication, Cloud Firestore, and Cloud Storage support optional private synchronization of saved exercises and images, while Firebase Hosting serves the live app. Cloud Sync and Cloud AI are independent choices.

Challenges we ran into:

  • Making imported mathematics trustworthy. A tiny OCR error can change an exponent, radical, or domain restriction and turn the rest of a solution into an answer to the wrong question. We added a review step where the source remains visible and the extracted question can be corrected before analysis. Our six-page workbook deliberately includes several different kinds of algebra, rather than a single clean screenshot.
  • Comparing AI routes fairly. On-device inference depends on Chrome and the machine; Gemini through Firebase AI Logic depends on consent, connectivity, and available quota. We kept the problem statement the same for both routes and show their actual availability and responses. In the demo, the logarithm domain matters as much as the discriminant: a convincing calculation is still incomplete if it ignores where the logs exist.
  • Keeping a notebook consistent offline. A temporary workspace draft, a saved exercise, and a cloud-synced exercise have different lifecycles. We had to make the pending state visible, send saved changes after reconnection, and preserve conflict copies when two devices edit the same work.
  • Putting the student ahead of the model. It was tempting to make the final AI answer the center of the interface. Instead, we had to design staged hints, private working notes, Solo mode, and selective illustration sharing so the student can investigate and revise their own reasoning.

Accomplishments that we're proud of:

  • A complete path from source to study record. A learner can bring in typed math, a photo, or a question from a multi-page PDF; review it; request concepts and hints; add a drawing and personal notes; then find the saved exercise again in a searchable library.
  • A comparison that can be checked. Our demo uses a parameterized algebra problem with exact thresholds and an answer key. It tests whether each AI route explains the domain, the zero/one/two-solution cases, and the root-gap condition, rather than merely producing a plausible final number.
  • A separate, solvable drawing demonstration. The geometry exercise has exact coordinates and a verifiable length ratio of \(10\). It shows the construction tools without mixing a geometry result into the algebra AI comparison.
  • Continuity across devices. With Cloud Sync enabled, saved exercises and their organization can move between two browser profiles using the same account. An offline edit can show a pending state and complete after reconnection, while the local notebook remains usable.

What we learned:

We learned that educational AI is most useful when its output is inspectable. Showing the original problem beside editable OCR, asking for the domain before solving, and keeping the student's notes with the AI exchange all make it easier to catch mistakes. We also learned that privacy and reliability need visible controls: a clear choice between Local and Cloud AI, consent before cloud requests, and an explicit sync state are part of the learning experience, not just implementation details.

What's next for Mathfolio:

We want to add stronger checks for parameterized algebra, including automatic prompts to verify domains and extraneous roots before accepting a worked solution. We also plan clearer uncertainty signals when OCR or an AI response is ambiguous, more guided geometry constructions with exact-coordinate checks, and easier export of a learner's own notebook. These are next steps, not features claimed in this build. Our aim is to help students keep a record of how they solved a problem, even when their first attempt was wrong.

Built With

  • cloud-firestore
  • cloud-storage-for-firebase
  • firebase
  • firebase-ai-logic
  • firebase-app-check
  • firebase-authentication
  • firebase-hosting
  • gemini
  • indexeddb
  • javascript
  • katex
  • latex
  • mathlive
  • pdf.js
  • progressive-web-app
  • react
  • svg
  • tesseract.js
  • typescript
  • vite
Share this project:

Updates

Submission history