diff --git a/.claude/settings.local.json b/.claude/settings.local.json
deleted file mode 100644
index 88639c5..0000000
--- a/.claude/settings.local.json
+++ /dev/null
@@ -1,38 +0,0 @@
-{
- "$schema": "https://json.schemastore.org/claude-code-settings.json",
- "permissions": {
- "allow": [
- "Bash(npm run build:*)",
- "Bash(npm run lint)",
- "Bash(git add:*)",
- "Bash(git commit:*)",
- "Bash(git push:*)"
- ],
- "deny": [],
- "ask": []
- },
- "hooks": {
- "Notification": [
- {
- "matcher": "",
- "hooks": [
- {
- "type": "command",
- "command": "osascript -e \"display notification \\\"Claude Code needs your attention\\\" with title \\\"Claude Code\\\" sound name \\\"Glass\\\"\""
- }
- ]
- }
- ],
- "Stop": [
- {
- "matcher": "",
- "hooks": [
- {
- "type": "command",
- "command": "osascript -e \"display notification \\\"Task completed successfully\\\" with title \\\"Claude Code\\\" sound name \\\"Hero\\\"\""
- }
- ]
- }
- ]
- }
-}
\ No newline at end of file
diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml
new file mode 100644
index 0000000..2261190
--- /dev/null
+++ b/.github/workflows/quality.yml
@@ -0,0 +1,24 @@
+name: Quality checks
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+
+permissions:
+ contents: read
+
+jobs:
+ check:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v7
+ - uses: actions/setup-node@v7
+ with:
+ node-version: 24
+ cache: npm
+ - run: npm ci
+ - run: npm run test
+ - run: npm run lint
+ - run: npm run build
+ - run: npm run check:production
diff --git a/.gitignore b/.gitignore
index 8e7b02c..60a5a56 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,6 +36,9 @@ yarn-error.log*
# vercel
.vercel
+# Local Supabase CLI cache
+/supabase/.temp/
+
# typescript
*.tsbuildinfo
next-env.d.ts
diff --git a/AGENTS.md b/AGENTS.md
deleted file mode 100644
index cc28401..0000000
--- a/AGENTS.md
+++ /dev/null
@@ -1,40 +0,0 @@
-# Repository Guidelines
-
-## Project Structure & Module Organization
-- App routes: `src/app` (Next.js 15 App Router, `layout.js`, chapter pages).
-- UI components: `src/components` grouped by chapter (e.g., `06-hypothesis-testing/6-1-4-PValueMeaning.jsx`).
-- Hooks/Utils/Lib: `src/hooks`, `src/utils`, `src/lib` (design system, quiz helpers).
-- Content & assets: `src/content` for MD/MDX; `public/` for static. Docs in `docs/`; course materials in `course-materials/`.
-- Config/Contexts/Services: `src/config`, `src/contexts`, `src/services`.
-- Templates & tutorials: `src/templates`, `src/tutorials`.
-- Path aliases: prefer `@/...` per `jsconfig.json` (e.g., `import X from '@/components/shared/X'`).
-
-## Build, Test, and Development Commands
-- `npm run dev`: Start local dev at `http://localhost:3000`.
-- `npm run build`: Production build (MDX enabled via `next.config.js`).
-- `npm start`: Serve the production build.
-- `npm run lint`: ESLint using Next `core-web-vitals` rules.
-- `npm run clean-build`: Remove `.next` then rebuild.
-
-## Coding Style & Naming Conventions
-- Indentation: 2 spaces; prefer single quotes and semicolons.
-- React: components in PascalCase; hooks camelCase prefixed with `use…`.
-- Files: chapter components use numeric prefixes (e.g., `3-3-1-NormalZScoreExplorer.jsx`).
-- Styling: Tailwind CSS; group utilities logically for readability.
-- Imports: order std → third‑party → local; use `@/...` paths.
-
-## Testing Guidelines
-- No formal runner configured. Validate by running `npm run dev`, exercising affected flows, and checking the console for errors.
-- Run `npm run lint` before commits.
-- If adding tests, prefer React Testing Library (components) and Playwright (e2e). Co‑locate tests near sources or in feature folders and mirror file names.
-
-## Commit & Pull Request Guidelines
-- Commits: use Conventional Commits (`feat:`, `fix:`, `refactor:`, `test:`). Keep messages imperative and scoped (e.g., `feat: add quiz system to chapter 4`).
-- PRs: include a clear description, link issues, and add screenshots/GIFs for UI changes. Note any migrations (e.g., D3 cleanup). Ensure `npm run lint` and `npm run build` pass locally.
-
-## Security & Configuration Tips
-- Respect `NODE_ENV` for dev vs prod. Do not commit secrets; use `.env.local`.
-- MDX math via `remark-math`/`rehype-katex`. Keep content in `src/content` and co‑locate chapter assets in their folders.
-
-## Architecture Overview
-- Next.js 15 App Router + MDX, Tailwind for styling, and path aliases via `jsconfig.json`. Shared design system and quiz helpers live under `src/lib` and `src/utils`.
diff --git a/CLAUDE.md b/CLAUDE.md
deleted file mode 100644
index faaae33..0000000
--- a/CLAUDE.md
+++ /dev/null
@@ -1,121 +0,0 @@
-# CLAUDE.md
-
-Ultrathink.
-
-This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
-
-## Project Overview
-Interactive probability and statistics learning platform built with Next.js 15, React 19, D3.js, and MathJax. Uses modern App Router architecture with feature-based component organization.
-
-## Primary Directive: Bug Fixing Only
-We are fixing bugs only. No new features.
-
-## Bug Resolution Workflow
-
-### 1. When you receive a bug
-1. Find the exact component from the screenshot/description
-2. Launch parallel agents to investigate:
- - One to analyze the broken component
- - One to find similar working components
- - One to check relevant docs and patterns
-
-### 2. Analyze from multiple angles
-For each bug, identify 5-7 potential causes (use parallel tasks/agents). Then narrow to 2 most likely causes based on evidence.
-- Find similar working component (`/src/components/learn/GoldStandardShowcase.jsx`)
-- Copy its pattern exactly
-- Check relevant `/docs/` guides
-- Don't create new solutions
-
-### 3. Verify the fix
-```bash
-npm run build && npm run lint # Always run before considering complete
-```
-
-Check:
-- Bug is actually fixed
-- No new errors introduced
-- All buttons/interactions work
-- No console errors
-
-### 4. Document what you learned
-After fixing, update `/Users/hananather/Desktop/Javascript/prob-lab/todo/` with:
-- What was actually broken
-- Why it was broken
-- What pattern fixed it
-
-## Commands
-```bash
-npm run dev # Start development server (localhost:3000)
-npm run build # Build for production
-npm run lint # Check code quality with ESLint
-npm run build && npm run lint # Pre-commit verification (always use)
-npm run clean-build # Clean build (removes .next directory)
-```
-
-## Architecture & Key Patterns
-
-### Component Architecture
-- **Gold Standard**: `/src/components/learn/GoldStandardShowcase.jsx` - Reference for all UI patterns
-- **Tabbed Learning**: 4-tab structure (Foundations, Worked Examples, Quick Reference, Interactive)
-- **Reusable Components**: `/src/components/ui/patterns/` for common patterns
-- **Chapter Organization**: `/src/components/01-07-*/` organized by course chapters
-
-### Critical Technical Patterns
-
-#### LaTeX Rendering (see `/docs/latex-guide.md`)
-- Always use `dangerouslySetInnerHTML` for LaTeX content
-- Use `useMathJax` hook with retry logic
-- Template literals for LaTeX props: `` `\(...\)` `` not regular quotes
-- Multi-letter subscripts: `_{\\text{XY}}` not `_{XY}`
-- Never manual MathJax processing
-
-#### D3.js Dragging (see `/docs/dragging-best-practices.md`)
-- Always use delta-based movement, never absolute positioning
-- No debouncing during drag operations
-- Use refs for drag state
-- Reusable: `D3DragWrapper`, `DraggableHandle`, `DraggableBars`
-
-#### State Management
-- Never localStorage in useState initializer (hydration issues)
-- Use useEffect for client-side only operations
-- React.memo for components containing LaTeX
-
-### Common Bug Patterns & Fixes
-
-1. **LaTeX not rendering**: Use `useMathJax` hook, check for race conditions
-2. **Dragging jumps**: Switch from absolute to delta-based positioning
-3. **Hydration errors**: Move localStorage to useEffect
-4. **Console warnings**: Check for missing keys, improper nesting
-5. **Build failures**: Fix TypeScript errors, missing imports
-6. **SVG/Chart spacing overlaps**: Elements below charts often overlap due to insufficient margins. Fix by using large explicit margins (e.g., `style={{ marginTop: '200px' }}`) instead of Tailwind classes like `mt-6`. This is especially common with D3.js SVGs where the height might not be properly accounted for in the layout flow.
-
-
-## Key Dependencies
-- **Framework**: Next.js 15, React 19
-- **Math**: MathJax 3, KaTeX, jstat
-- **Visualization**: D3.js ecosystem
-- **Styling**: Tailwind CSS 4, Framer Motion
-- **UI**: Radix UI, Lucide React
-
-## Development Guidelines
-- Professional tone, real applications, no gamification
-- Semantic color coding for mathematical concepts
-- Error boundaries for robustness
-- Performance: Dynamic imports, lazy loading
-- Accessibility: Proper ARIA labels, keyboard navigation
-
-## If unsure about anything, ask
-Don't guess about:
-- Which component to modify
-- What the bug actually is
-- Whether a fix might break something else
-
-## Resources
-- `/docs/latex-guide.md` - LaTeX rendering patterns
-- `/docs/dragging-best-practices.md` - D3 dragging implementation
-- `/docs/mathJax-racecondition-fixes.md` - MathJax timing issues
-- `/docs/tabbed-learning-migration.md` - Tabbed component patterns
-- `/src/components/learn/GoldStandardShowcase.jsx` - UI reference implementation
-
-
-Ultrathink.
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..b9d198c
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,59 @@
+# Contributing to Probability Lab
+
+Help students understand probability through correct explanations, worked examples, interactive experiments and useful feedback. Start with a reproducible problem or a proposed lesson improvement in the [issue tracker](https://github.com/hananather/probability/issues), then submit a scoped pull request.
+
+## Run and check the application
+
+Use Node.js 22.12 or later:
+
+```sh
+npm ci
+npm run dev
+```
+
+Before submitting a change:
+
+```sh
+npm run check
+npm run check:production
+```
+
+`check` runs the tests, lint and production build. `check:production` checks the built page routes on port 3100. These checks establish software behavior under their tested conditions; lesson quality also requires browser and mathematical review. See the [repository map](README.md#find-the-implementation) and [account validation](docs/accounts.md#validate-account-behavior) for relevant implementation and provider checks.
+
+## Change code without losing learning behavior
+
+Use the existing chapter components and shared controls before introducing another abstraction. Keep routes, stable activity/question IDs, saved progress and working interactions compatible. A refactor should preserve a student's answers, current lesson position and completed work. Describe any intentional behavior change separately.
+
+Use two-space indentation, single quotes and semicolons in new JavaScript. Prefer `@/` imports, PascalCase component names and `use…` hook names. Match the surrounding chapter's file organization. The [module guide](docs/tabbed-learning-guide.md) describes the current tab, section, math-rendering and progress components.
+
+Add meaningful regression tests for changed calculations, grading, persistence or interactions. Prefer independent reference calculations to expectations copied from the implementation. Include invalid inputs, boundary cases and degenerate cases when they affect the result. Report skips and unrun checks explicitly.
+
+For motion changes, clean up timers, event listeners and animation frames when a component unmounts or changes modes. Preserve understandable feedback with reduced motion and responsive controls while an animation runs. Support any performance claim with a reproducible measurement and comparison baseline.
+
+## Write and review a lesson
+
+Introduce prerequisites and symbols before using them. Explain the idea in plain language, state its mathematical conditions, work through a numerical example and offer a new case that tests transfer. Let students predict before revealing an answer. Explain why distractors fail, including the misconception each one represents. Distinguish exact results, approximations and simulations; label units, rounding and synthetic data.
+
+Review the complete activity from each learner perspective:
+
+| Perspective | Questions for review |
+| --- | --- |
+| A confused student | Are prerequisites visible? Can I connect the words, diagram and notation? Does feedback explain my mistake and the next step? |
+| A high-achieving student | Can I derive the result, identify its assumptions and limits, and apply it to a harder or unfamiliar example? |
+| A motivated student who needs manageable attention steps | Is the next action clear? Can I pause, return and resume? Are explanations divided into useful steps, with optional depth and control over motion? |
+
+Rate functionality, mathematical correctness, explanatory depth, writing clarity, visual clarity, and accessibility/learner control separately. The initial acceptance gate is at least **4 out of 5 in every dimension**, with no known mathematical error, data-loss defect or blocked essential interaction. Leave unreviewed dimensions unscored. The [lesson review rubric](docs/learning-quality.md) defines the scale and evidence requirements. Review ratings do not establish measured learning gains or clinical effects.
+
+Exercise the changed activity in the production build with a mouse and keyboard, at desktop and narrow widths including 390 and 320 pixels. Check labels, visible focus, equation wrapping or scrolling, reset/navigation controls, reduced motion and browser errors. Reload after work that saves progress. For account changes, verify the configured provider and ownership boundaries described in the account guide. Record the checked Git revision and the paths exercised.
+
+## Record content sources
+
+Write new explanations, questions and diagrams in your own words. For each added or adapted item, identify its creator and record its origin in the [content provenance ledger](docs/content-provenance.md). Direct reuse requires the exact applicable license or documented permission, the source URL and version/edition/page where relevant, and retained attribution or notices. A link to a learning resource records a reference; it does not document permission to incorporate its text, questions, artwork or branding.
+
+Preserve existing human author credits, including Patrick Boily and Hanan Ather. The repository-wide code and educational-content licenses are still unresolved. State any contribution-specific permission explicitly; this guide supplies no blanket reuse grant. Keep unresolved sources marked as unresolved rather than assuming they are original or cleared.
+
+## Submit a reviewable pull request
+
+Link the issue and explain the problem, resulting behavior and validation. Include numerical inputs and an independent calculation for a mathematical correction; include screenshots for visual changes. State remaining limitations, skipped checks and any migration or source-permission change. Use a Conventional Commit title such as `fix: correct sample size rounding`.
+
+Keep secrets, account backups, personal information and local working guidance out of shared files. Preserve educational material when removing unused code: establish its references, explain the removal and retain useful content through a separate documented location when appropriate.
diff --git a/README.md b/README.md
index beaed8f..033a194 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Probability Lab
-Interactive probability and statistics learning platform for MAT 2377 - Probability and Statistics for Engineers at the University of Ottawa.
+Probability Lab teaches probability and statistics through interactive lessons, simulations, worked examples and chapter quizzes. It began as a resource for MAT 2377, Probability and Statistics for Engineers at the University of Ottawa, and covers seven published chapters.
## Overview
@@ -12,15 +12,45 @@ An educational web app featuring interactive simulations and visualizations for
- Hypothesis testing
- Linear regression
-## Setup
+## Run locally
+
+Use Node.js 22.12 or later. Install the versions recorded in the lockfile:
```bash
-npm install
+npm ci
npm run dev
```
Open [http://localhost:3000](http://localhost:3000) to view the application.
+Lessons and guest progress work without account configuration. Optional email sign-in and account synchronization require a configured Supabase project and its owner-isolated progress table; see [account setup and validation](docs/accounts.md). Account deployment still requires verification against the intended provider.
+
+## Verify a change
+
+```bash
+npm run check
+npm run check:production
+```
+
+`check` runs the assertion suite, ESLint and the production build. `check:production` starts that build on port 3100, checks the generated page routes and stops its server. Route checks verify HTTP reachability. Exercise the changed lesson's controls in a browser at desktop and narrow widths, including keyboard use and reduced motion.
+
+The real-provider integration fixture is explicitly skipped when it is not configured. See [account validation](docs/accounts.md#validate-account-behavior) for its separate database and ownership checks. Test and build results apply to the checked revision.
+
+## Find the implementation
+
+| Path | Purpose |
+| --- | --- |
+| [src/app](src/app) | Next.js pages, layouts and account API routes |
+| [src/components](src/components) | Chapter lessons, shared controls and visualizations |
+| [src/lib/curriculum/manifest.js](src/lib/curriculum/manifest.js) | Stable lesson IDs, published chapters and progress denominators |
+| [src/lib/statistics](src/lib/statistics) | Numerical functions used by lessons |
+| [src/lib/progress](src/lib/progress) | Guest/account storage, migration, synchronization and recovery |
+| [src/lib/quiz](src/lib/quiz) | Question banks, grading and pinned quiz sessions |
+| [src/lib/mathjax](src/lib/mathjax) | Shared mathematical rendering |
+| [tests](tests) | Numerical, interaction, persistence and ownership assertions |
+
+Add explanations and examples in the chapter's existing learning structure. Check each numerical answer and its conditions, and preserve working interactions and saved progress when refactoring. Record the source and permission for incorporated text, questions or assets. The repository's overall license and content attribution are still being resolved; existing third-party rights and author credits remain applicable.
+
## Tech Stack
- Next.js 15 + React 19
diff --git a/docs/accounts.md b/docs/accounts.md
new file mode 100644
index 0000000..2b04a71
--- /dev/null
+++ b/docs/accounts.md
@@ -0,0 +1,29 @@
+# Optional accounts and progress
+
+Lessons are available without an account. Guest progress stays in the browser. A configured account can synchronize completed study records, quiz history and quiz preferences. Reading positions and unfinished quizzes stay on their device.
+
+The progress page separates local persistence from cloud acknowledgement. Pending, conflicting or unsupported updates require attention and remain available in exported backups. Signing out retains account history and the guest copy. Guest records enter an account only through the explicit review-and-add action.
+
+## Configure an installation
+
+1. Create or select the Supabase project for the installation. Enable [email sign-in](https://supabase.com/docs/guides/auth/auth-email-passwordless) and configure email delivery.
+2. Add the installation's `/auth/callback` URL to the provider's [redirect allowlist](https://supabase.com/docs/guides/auth/redirect-urls) and set its site URL. A local example is `http://localhost:3000/auth/callback`; use the same host in the browser and provider configuration.
+3. Apply [the learning-progress migration](../supabase/migrations/202610030001_learning_progress.sql). It restricts each row to its authenticated owner and requires revision-controlled writes. Apply the row policies and grants as part of the migration.
+4. Set `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY` in `.env.local` for local development, or in the hosting environment before building. Use the project's publishable key or legacy anonymous key. The configuration rejects service-role keys. Keep secret/admin credentials out of these public variables.
+5. Restart development or rebuild production after changing public configuration. With missing or invalid configuration, sign-in remains unavailable and guest learning continues.
+
+The browser requests an email link, which returns to the callback in that same browser to complete PKCE verification. Server endpoints verify the current account before reading or changing progress. The database row policies remain necessary even when using those endpoints.
+
+## Validate account behavior
+
+Run the [SQL ownership assertions](../supabase/tests/learning_progress_rls.sql) against the test database. The [real-provider fixture](../tests/auth/remote.integration.test.js) exercises ordinary anonymous/authenticated requests, separate account isolation, revision conflicts and replay against an isolated local Supabase runtime. It requires a loopback URL and two fresh confirmed test accounts; it does not delete existing records. This fixture does not verify a hosted provider.
+
+The fixture's input is a private JSON file with `url`, `publishableKey`, and separate `accountA`/`accountB` objects containing `id` and `accessToken`. Restrict it to mode 0600. Then run:
+
+```bash
+PROBABILITY_AUTH_TEST_FILE=/absolute/path/to/private-test-fixture.json node supabase/tests/run-account-gate.mjs
+```
+
+Before enabling hosted accounts, test the actual email/callback flow, explicit guest transfer, completed quiz synchronization, sign-out, device-local drafts, recovery and two independent browser contexts against that provider. Component fixtures and a successful build do not establish email delivery or production synchronization.
+
+Account recovery imports require the same account and device. They can replay original pending updates and archive the original file, while retaining current account history. Imported snapshots and archived blocked records do not become cloud authority. Keep the original backup when an import is refused or cannot be saved durably.
diff --git a/docs/content-provenance.md b/docs/content-provenance.md
new file mode 100644
index 0000000..619e080
--- /dev/null
+++ b/docs/content-provenance.md
@@ -0,0 +1,43 @@
+# Content provenance
+
+Probability Lab is intended to be free for students. Its repository-wide code and educational-content licenses are still unresolved. This ledger records identified origins and outstanding evidence; it supplies no license grant. Preserve the existing credits to **Patrick Boily and Hanan Ather** in the [course overview](../src/content/probability.mdx) and [about page](../src/app/about/page.js).
+
+Ledger reviewed against the repository on 2026-10-05. It covers the items below, not every explanation, question, dependency or distributed asset.
+
+## Record an item
+
+For each lesson, question, dataset, diagram or asset, record:
+
+- Its stable activity/question ID, source path and the part incorporated.
+- Its creator and whether it is **original**, **adapted**, **reference-only** or **unknown**. Use original only with an identified creator and authorship statement. Reference-only means the project links to or cites the source; it does not clear incorporated material.
+- The source URL and exact version, edition and page where relevant. For original work, record its origin instead of inventing an external source.
+- The exact license and license URL, or permission evidence and its scope. Mark missing evidence unknown; retain required credits and notices. Keep private permission records private and provide a public evidence reference or approved summary.
+- Mathematical review: inputs, assumptions, independent calculation or test, checked revision, and remaining concerns. Numerical correctness and reuse permission are separate checks.
+
+## Existing content and assets
+
+“Unknown” below means the current repository does not document the needed origin or permission. It does not establish copying or ownership.
+
+| Item and current evidence | Origin/source status | Permission and next evidence needed |
+| --- | --- | --- |
+| [Course overview](../src/content/probability.mdx), rendered by [overview page](../src/app/overview/page.js) | Credits Patrick Boily and Hanan Ather; per-explanation original/adapted status unknown. | Contribution-specific reuse permission unknown. Preserve both credits and document the origin of incorporated explanations. |
+| [Probability dictionary table](../src/components/01-introduction-to-probabilities/02-probability-dictionary/Tab3QuickReferenceTab.jsx), section `complete-dictionary` | Comment identifies a textbook image; book, creator, edition, page and source URL unknown. | Exact license/permission unknown. Identify the source or provide an independently written table and examples, retaining the lesson's teaching function and mathematical review. Removing the comment would not resolve provenance. |
+| [Chapter question bank](../src/lib/quiz/questionBank.js) | Questions have stable IDs and explanations; per-question creator and original/adapted status unknown. | Source URLs and licenses/permissions unknown. Add item-level records. [Question-bank assertions](../tests/math/question-bank.test.js) provide numerical checks for specified cases, not a source-permission record or a review of every explanation. |
+| CLT visualizations: [shared](../src/components/shared/CLTSimulation.jsx), [overview](../src/components/overview-components/CLTSimulation.jsx), [chapter four](../src/components/04-descriptive-statistics-sampling/4-6-central-limit-theorem/4-6-3-CLTSimulation.jsx) | Each mentions reference CLT code. Whether the reference is internal or external, its creator, version and source URL are unknown. All three have current source imports. | Exact reference license/permission unknown. Identify it and retain applicable notices. Consolidation also needs behavior checks for the importing lessons. |
+| [University logo](../public/uo.png), displayed by the course overview | Identified uOttawa brand image; original asset URL/creator unknown. | Asset-specific authorization unknown. Record it separately from any future platform license. |
+| [Hanan portrait](../src/app/about/Hanan.jpg) and [Patrick portrait](../src/app/about/Patrick.png), displayed by the about page | Subjects are identified; photographers and original asset URLs unknown. | Redistribution permission unknown. Record creator, source and authorization for each image; retain the human contributor credits. |
+| [Favicon](../src/app/favicon.ico) | Creator and source unknown. | Exact license/permission unknown. Identify its origin or provide documented original artwork. |
+| [Chapter-three MDX](../src/content/chapter3.mdx) | Creator and original/adapted status unknown. No current incoming source import was identified. | Source URLs and permissions unknown. Preserve its educational content while reconciling it with current lessons; lack of an import is not a reason to discard its provenance. |
+| [F-distribution worked example](../src/components/04-descriptive-statistics-sampling/4-7-advanced-distributions/4-7-4-FDistributionWorkedExample.jsx) | Explicit reference link to [NIST's F-test explanation](https://itl.nist.gov/div898/handbook/eda/section3/eda359.htm). The source link is reference-only; the lesson's text/example authorship remains unknown. | No incorporated-material permission is recorded. Keep the reference and distinguish any future direct reuse from independently written explanation. |
+| Khan Academy resource links in [prerequisites](../src/app/prerequisites/page.js) and [prerequisite review](../src/app/resources/prerequisite-review/page.js) | Reference-only links to [Khan Academy math](https://www.khanacademy.org/math). These links do not embed a Khan lesson. | No claim of a content license or permission to reuse Khan materials is made by these links. Record exact terms if material is incorporated later. |
+
+## Software sources and notices
+
+Dependency licensing is separate from educational-content provenance. [package-lock.json](../package-lock.json) identifies installed versions; retain their full upstream notices when distributing the relevant artifacts. A complete notice inventory and distribution review remain open.
+
+| Item | Source/license evidence | Unresolved scope |
+| --- | --- | --- |
+| UI scaffold in [components.json](../components.json) and [button.jsx](../src/components/ui/button.jsx) | The configuration names shadcn/new-york. Current upstream [shadcn license](https://raw.githubusercontent.com/shadcn-ui/ui/main/LICENSE.md) is MIT. | Exact registry revision and incorporated scaffold files/notices are not recorded. The current upstream license is not evidence of the exact source revision used here. |
+| MathJax loaded by [config.js](../src/lib/mathjax/config.js) | The loader pins 3.2.2; that version's [upstream license](https://raw.githubusercontent.com/mathjax/MathJax/3.2.2/LICENSE) is Apache-2.0. | Record the full notices for the actual distributed software. This software license does not license the lesson text. |
+
+New contributions should update this ledger with item-level evidence rather than treating an entire chapter as cleared. Use the [contribution guide](../CONTRIBUTING.md) for the software and teaching checks required with a change.
diff --git a/docs/latex-guide.md b/docs/latex-guide.md
index aa8091a..6233bc7 100644
--- a/docs/latex-guide.md
+++ b/docs/latex-guide.md
@@ -1,271 +1,87 @@
-# LaTeX Rendering Guide
+# Render mathematics in a lesson
-## Core Principle
-Always use `dangerouslySetInnerHTML` for LaTeX content. This is the standard, reliable approach.
+Use the existing MathJax provider and shared hook or section wrapper. They wait for renderer readiness, serialize work, retire removed content and expose failures through the shared retry flow. MathJax recommends sequencing asynchronous typesetting and clearing removed math; the application owns those operations in [its runtime](../src/lib/mathjax/runtime.js). See the [MathJax 3.2 typesetting documentation](https://docs.mathjax.org/en/v3.2/web/typeset.html).
-```jsx
-
-```
+## Render a section
-## The Standard Pattern (From Working Components)
-Based on our gold standard components, use this simple and reliable pattern:
+[MathJaxSection](../src/components/ui/MathJaxSection.jsx) handles its children through the shared hook. Give formulas their inline or display delimiters and render strings as React text:
```jsx
-import React, { useEffect, useRef } from "react";
+import MathJaxSection from '@/components/ui/MathJaxSection';
-const YourComponent = () => {
- const contentRef = useRef(null);
-
- useEffect(() => {
- const processMathJax = () => {
- if (typeof window !== "undefined" && window.MathJax?.typesetPromise && contentRef.current) {
- if (window.MathJax.typesetClear) {
- window.MathJax.typesetClear([contentRef.current]);
- }
- window.MathJax.typesetPromise([contentRef.current]).catch(console.error);
- }
- };
-
- processMathJax(); // Try immediately
- const timeoutId = setTimeout(processMathJax, 100); // CRITICAL: Retry after 100ms
- return () => clearTimeout(timeoutId);
- }, [/* dependencies */]);
-
+export default function ExpectationFormula() {
return (
-
);
-});
-```
-
-## CRITICAL: Props vs Hardcoded LaTeX
-
-### ⚠️ Template Literals vs Regular Quotes
-When passing LaTeX as props, **you MUST use template literals**, not regular quotes:
-
-```jsx
-// ❌ WRONG - Regular quotes break when passed as props
-
-
-// ✅ CORRECT - Template literals preserve escaping
-
+}
```
-### Why This Matters
-React/Next.js prop serialization handles escape sequences differently:
-- Regular quotes (`"..."`) → Backslashes get stripped during prop passing
-- Template literals (`` `...` ``) → Backslashes are preserved correctly
+The existing-ref form is `useMathJax(contentRef, [mean])`, with `contentRef` created by `useRef(null)`. Choose either the hook or the section wrapper to own a region. For independently changing nested content, define child components at module scope and give each region its own stable owner.
-### Best Practice: Include Delimiters in Props
-When passing LaTeX formulas as props, include the delimiters:
+A formula-bearing button needs an accessible name that describes its action, such as “Show the variance derivation.” Keep calculation state in React and rendering work in the shared runtime. Adding a per-component timer or calling `window.MathJax.typesetPromise` directly creates a separate rendering lane.
-```jsx
-// ❌ WRONG - Adding delimiters in component
-
-// Component does:
+## Keep text and TeX within their boundaries
-// ✅ CORRECT - Include delimiters in the prop
-
-// Component does:
-```
+Render imported questions, explanations and other external strings as React text. The provider requires the configured Safe extension and restricts TeX URLs, classes, IDs and styling; those checks supplement text escaping. See the [MathJax Safe options](https://docs.mathjax.org/en/v3.2/options/safe.html) and [runtime safety controls](../tests/mathjax/runtime/safety.test.js).
-## Common Mistakes to Avoid
+Existing static authored formulas may use `dangerouslySetInnerHTML`. For a component that requires those legacy props, `useLatexString(latex, inline)` escapes the text before adding delimiters. Use it only inside a region owned by the shared renderer. Preserve the safety configuration when changing the loader or renderer.
-### 1. Basic LaTeX Rendering
-```jsx
-// ❌ WRONG - Won't render
-\(E[X] = \mu\)
-
-
Step with inline math \(E[X^2]\):
+Math notation and JavaScript have separate jobs. `\rho_{XY}` gives two mathematical indices; `\rho_{\text{sample}}` gives a descriptive text subscript. Choose the notation for its meaning. Choose layout classes for spacing, contrast and wrapping.
-// ✅ CORRECT
-
-
-
Step with inline math :
-```
+## Make long equations usable
-### 2. Multi-Letter Subscripts
-**CRITICAL**: Multi-letter subscripts must be wrapped in `\text{}` to prevent MathJax errors:
+Provide a named scrolling region for a long equation, with keyboard focus and a visible focus indicator. Keep a readable explanation beside the formula. For example:
```jsx
-// ❌ WRONG - Causes "Can't find variable: XY" error
-
-
-// ✅ CORRECT - Use \text{} for multi-letter subscripts
-
+import MathJaxSection from '@/components/ui/MathJaxSection';
-// ✅ Single letters work without \text{}
-
-```
-
-**Rule**: Any subscript with more than one letter needs `\text{}`:
-- `_{X}` → Works (single letter)
-- `_{XY}` → Breaks (MathJax looks for JS variable)
-- `_{\\text{XY}}` → Works (properly escaped text)
-- `_{\\text{sample}}` → Works (descriptive subscripts)
-
-### LaTeX Re-rendering Issues
-**Problem**: LaTeX "unrenders" when component state changes (e.g., during simulations)
-**Solution**: Wrap LaTeX-containing sections in React.memo to prevent re-renders
-```jsx
-const FormulaSection = React.memo(function FormulaSection({ params }) {
- const ref = useRef(null);
- useEffect(() => {
- // MathJax processing logic
- }, [params]);
- return
...
;
-});
-```
-
-## Quick Implementation Checklist
-
-- [ ] Use dangerouslySetInnerHTML for ALL LaTeX
-- [ ] Add processMathJax() + setTimeout(..., 100) pattern
-- [ ] Use React.memo for components that shouldn't re-render
-- [ ] Apply ref to container element
-- [ ] Include proper imports (React, useEffect, useRef, useState)
-
-## LaTeX in Custom Components
-UI components may not handle LaTeX props correctly. Use direct elements with dangerouslySetInnerHTML instead.
-
-## CRITICAL: Hub Components Requirements
-
-### ⚠️ Required CSS Classes for MathJax
-**ALWAYS use `font-mono` class** - MathJax depends on monospace font context:
-
-```jsx
-// ✅ CORRECT - Required pattern for all hubs
-
+ );
+}
```
-### ⚠️ Use Proper MathJax Hook
-**Always use `useMathJax` hook** - Don't manually process:
+At phone widths, shorten labels or stack a derivation where that keeps the meaning clear. Use scrolling when the complete equation needs more space, and keep the page itself within the viewport.
-```jsx
-// ✅ CORRECT - Use the hook
-import { useMathJax } from "../../hooks/useMathJax";
-
-const YourComponent = () => {
- const contentRef = useMathJax([dependencies]);
- return
...
;
-};
+## Verify the rendered lesson
-// ❌ WRONG - Manual processing is unreliable
-useEffect(() => {
- window.MathJax?.typesetPromise([ref.current]);
-}, []);
-```
+Run `npm run test -- tests/mathjax` for the shared renderer controls and `npm run check` before submitting code changes. Exercise the changed page with its actual controls: update numbers, toggle details, switch tabs, leave and return, and use the shared retry after a rendering failure. Check fractions, roots, subscripts, raw delimiters, visible errors and keyboard access at desktop and phone widths. A successful build alone does not establish mathematical or rendering correctness.
-### Hub Component Checklist
-- [ ] `font-mono` class present
-- [ ] No flex containers around LaTeX
-- [ ] Using `useMathJax` hook
-- [ ] `dangerouslySetInnerHTML` for all LaTeX
-- [ ] Proper ref attachment
\ No newline at end of file
+[Tabbed module guide](tabbed-learning-guide.md) · [Contributing](../CONTRIBUTING.md)
diff --git a/docs/learning-quality.md b/docs/learning-quality.md
new file mode 100644
index 0000000..efbf6c1
--- /dev/null
+++ b/docs/learning-quality.md
@@ -0,0 +1,55 @@
+# Reviewing a lesson
+
+A lesson passes review when its mathematics is correct, its interactions work, and a student can explain the idea and apply it to a new example. Review the production build, record the Git revision, and keep source inspection, browser observations, numerical checks, and learning outcomes separate.
+
+## Check the software
+
+Use Node.js 22.12 or later. From the repository root:
+
+```sh
+npm ci
+npm run check
+npm run check:production
+```
+
+`check` runs the tests, lint, and production build. `check:production` starts the built application on port 3100, checks its page routes, and stops the server. Passing these commands establishes software checks; it does not establish lesson quality.
+
+## Review every reachable activity
+
+Start at the chapter hub and follow each lesson, reference, quiz, and supplementary link. Include published routes that are reachable elsewhere, such as the resource library and saved quiz review. Report a broken published link even if its destination is an older route.
+
+For each activity:
+
+1. Work through it with a mouse and keyboard. Try predictions before revealing answers, change sliders and inputs, and use next, previous, reset, and completion controls.
+2. Inspect rendered equations, labels, units, assumptions, and numerical results. Compare calculations with an independent calculation, including boundary and degenerate cases.
+3. Review desktop, tablet, and narrow mobile layouts. Suggested widths are 1400, 768, 390, and 320 pixels. Check text wrapping, equation scrolling, focus visibility, control labels, touch targets, and the absence of unintended page-wide horizontal scrolling.
+4. Use reduced motion. Check that the lesson remains understandable without animation and that ongoing motion has an accessible stopping mechanism where needed.
+5. Reload after navigation, study completion, and quiz activity. Check that saved position, studied content, and assessed answers remain distinct. Exercise backup export/import and failed-save recovery when the activity writes progress.
+6. Inspect browser errors and failed requests. Record the action that triggered a problem and whether it repeats.
+
+## Review the teaching
+
+Read the activity from three perspectives: a student who is confused by its prerequisites, a student seeking deeper derivations and transfer, and a motivated student who benefits from short, manageable steps and clear return points. These perspectives guide review; they do not establish clinical effects or measured learning gains.
+
+Rate each dimension from 1 to 5 and give evidence for the rating:
+
+| Dimension | What to inspect |
+| --- | --- |
+| Functionality | Controls, navigation, saved state, and recovery work under the tested conditions. |
+| Mathematical correctness | Definitions, assumptions, derivations, answer keys, and numerical results agree. |
+| Explanatory depth | The activity explains why the method works, connects representations, and supports transfer. |
+| Writing clarity | Terms are introduced before use; questions, instructions, and feedback have a clear meaning. |
+| Visual clarity | Layout and diagrams direct attention to the relevant quantities and relationships. |
+| Accessibility and learner control | Keyboard operation, labels, readable layouts, pacing, reduced motion, and return points support use. |
+
+Use 1 for unusable or misleading, 2 for major obstacles, 3 for usable with unresolved teaching or interaction gaps, 4 for a coherent explanation and verified usable path, and 5 for that standard plus deeper transfer and independently checked difficult cases. A rating is a review judgment, not a measured student outcome. Leave an unreviewed dimension unscored.
+
+The initial acceptance threshold is at least 4 in every dimension, with no known mathematical error, data-loss defect, or blocked essential interaction. A strong average cannot compensate for a failing dimension. Preserve adverse findings and retest the affected path after each correction.
+
+## Report a reproducible finding
+
+Include the revision, route, exact action, expected result, observed result, severity, and evidence. Attach a screenshot when appearance matters; include the numerical inputs and independent reference calculation when mathematics matters. Identify the component only after inspecting its source. Separate a verified cause from a suspected cause.
+
+Prioritize crashes, data loss, wrong mathematics, and inaccessible essential controls first. Then address misleading explanations, broken layouts, and unnecessary interaction cost. Keep cosmetic changes separate from changes to a definition, assumption, answer key, or assessment policy.
+
+After a fix, repeat its reproduction and the related working path. Record which checks ran and which remain open. An HTTP response, passing unit test, or saved screenshot alone does not prove that the complete lesson passes this review.
diff --git a/docs/puppeteer-bug-audit-prompt.md b/docs/puppeteer-bug-audit-prompt.md
deleted file mode 100644
index fee57a8..0000000
--- a/docs/puppeteer-bug-audit-prompt.md
+++ /dev/null
@@ -1,116 +0,0 @@
-# Systematic Bug Audit Prompt Using Puppeteer
-
-## Objective
-Perform a comprehensive visual and functional bug audit of each chapter in the probability learning platform using Puppeteer automation.
-
-## Instructions for Claude Code
-
-### Initial Setup
-1. Ensure dev server is running on http://localhost:3000
-2. Create a new todo list file for the chapter being audited: `/todo/chapter-[N]-bugs.md`
-
-### Systematic Audit Process
-
-For each chapter (1-7), execute the following:
-
-1. **Navigate to Chapter Hub**
- ```
- Navigate to http://localhost:3000/chapter[N] using Puppeteer
- Take screenshot named "chapter-[N]-hub-initial"
- ```
-
-2. **Launch Parallel Sub-Agents**
- Launch 6 parallel sub-agents (one for each module in the chapter) with these tasks:
- - Sub-agent 1-6: Audit individual chapter sections
- - Each sub-agent should independently navigate to their assigned module
- - Collect bugs specific to their section
-
-3. **Bug Categories to Check**
- Each sub-agent must evaluate:
- - **Visual Bugs**: Layout breaks, overlapping elements, missing UI components
- - **LaTeX Rendering**: Mathematical equations not displaying, incorrect formatting
- - **Interactive Elements**: Buttons/sliders/inputs not responding, drag-drop failures
- - **Console Errors**: JavaScript errors in browser console
- - **Mathematical Correctness**: Verify formulas and calculations are accurate
- - **Responsive Design**: Test at viewport widths: 375px (mobile), 768px (tablet), 1400px (desktop)
-
-4. **Bug Documentation Format**
- For each bug found, document:
- ```markdown
- ## Bug #[number]: [Concise Bug Title]
- - **Location**: chapter[N]/section-[name]/component-[name]
- - **Priority**: Critical | High | Medium | Low
- - **Type**: Visual | Functional | Mathematical | Performance
-
- ### Description
- [One sentence describing what's wrong]
-
- ### Visual Evidence
- - Screenshot: [screenshot-name]
- - Console errors: [if any]
-
- ### How It Manifests
- - User action that triggers it
- - Expected vs actual behavior
-
- ### Technical Details
- - Component file: [exact file path]
- - Suspected cause: [based on code analysis]
- - Similar working component: [reference]
-
- ### Proposed Fix
- [Specific implementation plan referencing gold standard patterns]
- ```
-
-5. **Priority Ratings**
- - **Critical**: App crashes, data loss, completely broken functionality
- - **High**: Major visual breaks, incorrect math, non-functional interactions
- - **Medium**: Minor visual issues, console warnings, suboptimal UX
- - **Low**: Cosmetic issues, enhancement opportunities
-
-6. **Validation Steps**
- For each bug:
- - Verify it's reproducible (not a one-time glitch)
- - Check if it's already fixed in recent commits
- - Confirm it's not an intentional design choice
- - Test if the issue exists in similar components
-
-### Execution Commands
-
-```bash
-# For each chapter, ask Claude:
-"Audit Chapter [N] for bugs using Puppeteer. Launch 6 parallel sub-agents to check each module. Focus on visual bugs, LaTeX rendering, interactive elements, and mathematical correctness. Create detailed bug report in /todo/chapter-[N]-bugs.md"
-
-# Specific module audit:
-"Navigate to [specific module URL] and perform comprehensive bug check including visual issues, console errors, and mathematical accuracy. Take screenshots of any problems found."
-
-# Cross-reference check:
-"Compare this broken component with the gold standard at /src/components/learn/GoldStandardShowcase.jsx and identify pattern differences"
-```
-
-### Output Format
-Create `/todo/chapter-[N]-bugs.md` with:
-1. Chapter overview and total bug count
-2. Bugs organized by module/section
-3. Summary table with priorities
-4. Recommended fix order based on dependencies
-
-### Example Prompt for Chapter 7
-```
-"Audit Chapter 7 (Linear Regression) using Puppeteer. Navigate to http://localhost:3000/chapter7 and verify all 6 modules load correctly. Launch parallel sub-agents to check:
-1. Simple Linear Regression
-2. Correlation Coefficient
-3. Least Squares Method
-4. Hypothesis Testing in Regression
-5. Confidence & Prediction Intervals
-6. Multiple Regression Basics
-
-For each module, check for visual bugs, LaTeX rendering issues, interactive element failures, and mathematical correctness. Document all findings in /todo/chapter-7-bugs.md with priority ratings and fix proposals."
-```
-
-### Important Notes
-- Ignore 404s for non-existent legacy routes (these aren't bugs)
-- Focus only on components accessible from chapter hub pages
-- Verify bugs are real issues, not artifacts from old code
-- Reference `/docs/` guides for proper patterns
-- Always compare with gold standard implementation
\ No newline at end of file
diff --git a/docs/quality/review-standard.md b/docs/quality/review-standard.md
new file mode 100644
index 0000000..fcfda5b
--- /dev/null
+++ b/docs/quality/review-standard.md
@@ -0,0 +1,48 @@
+# Lesson quality standard
+
+A lesson is ready for release when its calculations and explanations are correct, its controls work, and learners can use it with a keyboard and on a narrow screen. Review ratings summarize observed quality; they do not establish learning outcomes.
+
+Review each lesson, example, question, and answer from three perspectives:
+
+- A learner encountering the concept for the first time: are prerequisites explicit, symbols defined, and feedback enough to recover from a mistake?
+- A learner seeking depth: are assumptions, derivations, boundary cases, and transfer problems available?
+- A motivated learner with attention difficulties: is the next action clear, is information divided into coherent steps, and can the learner pause, resume, or reduce motion without losing context?
+
+Rate each dimension separately on a five-point scale:
+
+| Dimension | Evidence for a rating of at least 4 |
+| --- | --- |
+| Mathematical correctness | Independently checked answers, stated assumptions, consistent notation, and verified numerical boundary cases. |
+| Functionality | Working navigation, controls, feedback, and saved state; meaningful regression checks and actual browser use. |
+| Accessibility | Keyboard access, visible focus, named controls, usable narrow layout, readable contrast, and reduced motion. |
+| Clarity | Defined terms, concise instructions, consistent units, and specific feedback explaining mistakes. |
+| Explanatory depth | An intuitive model, its mathematical connection, worked reasoning, and opportunities to apply the idea beyond the example. |
+| Visual and interaction quality | Legible diagrams, stable layouts, purposeful motion, and responsive interactions without distracting animation. |
+
+A rating of 1 means a blocking defect; 2 means major gaps; 3 means usable with material gaps; 4 means the evidence above is present; 5 means the lesson also handles challenging cases and learner recovery especially well. Record the observed evidence and remaining limitations with each rating. An average cannot compensate for a blocking defect or a dimension below 4.
+
+## Verification loop
+
+1. Identify the route, components, examples, and question IDs under review.
+2. Reproduce reported failures before editing.
+3. Make a scoped change that preserves working routes, content, and learner history.
+4. Check calculations against an independent reference and run appropriate regression tests.
+5. Use the changed flow in a browser at desktop and narrow widths, with keyboard controls and reduced motion where relevant.
+6. Review the result from the three learner perspectives. Fix defects that prevent the release standard.
+7. Record the revision, evidence, limitations, and follow-up work in the associated issue and pull request.
+
+Repository checks:
+
+```sh
+npm ci
+npm run check
+npm run start -- --hostname 127.0.0.1 --port 3000
+```
+
+In a second terminal, check that built pages respond:
+
+```sh
+node scripts/check-routes.mjs
+```
+
+The route check verifies HTTP responses and HTML, not client interactions or learning quality. Browser use remains a separate requirement. Numerical tests, lint, build, route checks, and browser evidence must identify the revision they cover. Unreviewed material stays unreviewed until those checks are performed.
diff --git a/docs/tabbed-learning-guide.md b/docs/tabbed-learning-guide.md
index 68013ad..47f834d 100644
--- a/docs/tabbed-learning-guide.md
+++ b/docs/tabbed-learning-guide.md
@@ -1,211 +1,46 @@
-# Tabification Prompt - Transform Components to Learning Modules
-Transform the following into a tabbed learning module:
-
-INPUTS:
-1. Existing component: [PASTE COMPONENT CODE]
-2. Course content: [PASTE RELEVANT COURSE MATERIAL/TEXTBOOK CONTENT]
-3. Component path: [CURRENT PATH OF COMPONENT]
-
-REQUIREMENTS:
-Create a standardized tabbed module that:
-- Wraps content in TabbedLearningPage
-- Creates 3 new educational tabs
-- ALWAYS includes the existing component as a 4th tab (unchanged)
-- Each educational tab uses SectionBasedContent with 4 sections (3-5 min each)
-- Implements arrow key navigation and progress tracking
-
-IMPORTANT: The existing component is ALWAYS preserved as-is and becomes one of the tabs!
-
-TAB STRUCTURE:
-
-TAB 1 - FOUNDATIONS (Green #10b981):
-□ Section 1: "Can You Solve This?" - Problem for motivation (try to use course content`/Users/hananather/Desktop/Javascript/prob-lab/course-materials/content`)
-□ Section 2: "Building Intuition" - Plain language before math
-□ Section 3: "Formal Definition" - Mathematical rigor with LaTeX
-□ Section 4: "Why This Matters"
-- relevance to future topics in the course (if applicable)
-- relevance to other courses (if applicable)
-
-
-TAB 2 - WORKED EXAMPLES (Blue #3b82f6):
-□ Section 1: "Basic Example" - Simple case with steps
-□ Section 2: "Example 2" - Complex problem fully solved (from course content`/Users/hananather/Desktop/Javascript/prob-lab/course-materials/content`)
-□ Section 3: "Variations" - Different types they'll encounter (if applicable)
-□ Section 4: "Short Quiz to test your understanding" - Interactive practice (from course content`/Users/hananather/Desktop/Javascript/prob-lab/course-materials/content`)
-
-TAB 3 - QUICK REFERENCE (Violet #7c3aed):
-□ Section 1: "Formula Sheet" - All formulas with when to use
-□ Section 2: "Decision Guide" - If X then Y flowchart
-□ Section 3: "Common Mistakes" - What to avoid
-□ Section 4: "Practice Problems" - problems
-
-TAB 4 - ORIGINAL COMPONENT (Keep original color):
-□ ALWAYS include the existing component that's being "tabified"
-□ Import it WITHOUT any modifications
-□ Just wrap it to work within tab structure
-□ Title: Use the original component's name
-□ This preserves all existing functionality users are familiar with
-
-CONTENT RULES:
-✗ NO fake statistics ("appears in 75% of exams")
-✗ NO gamification or childish tone
-✓ Real applications (ML, AI, data science careers)
-✓ Connect to advanced topics and industry
-✓ Professional, respectful tone
-✓ LaTeX using dangerouslySetInnerHTML pattern
-
-FILE STRUCTURE RULES:
-If original component is: /components/XX-chapter/Y-Y-Y-ComponentName.jsx
-Then create:
-
-1. NEW FOLDER: /components/XX-chapter/Y-Y-Y-component-name/
- - Keep the section numbering (Y-Y-Y) from original component
- - Slugify only the component name part
- - Contains:
- - Tab1FoundationsTab.jsx
- - Tab2WorkedExamplesTab.jsx
- - Tab3QuickReferenceTab.jsx
- - index.jsx (exports all tabs)
-
-2. NEW PAGE: /app/chapter[X]/component-name/page.jsx
- - Use only the slugified name part (no section numbers)
- - This keeps URLs clean and readable
-
-3. ORIGINAL COMPONENT: Keep in original location
- - DO NOT move or rename
- - Import from original path in Tab 4
-
-Example:
-Original: /components/01-introduction/1-1-1-SampleSpacesEvents.jsx
-Creates folder: /components/01-introduction/1-1-1-sample-spaces-events/
- - Tab1FoundationsTab.jsx
- - Tab2WorkedExamplesTab.jsx
- - Tab3QuickReferenceTab.jsx
- - index.jsx
-Creates page: /app/chapter1/sample-spaces-events/page.jsx
-Imports original from: /components/01-introduction/1-1-1-SampleSpacesEvents.jsx
-```
-
-## 📋 Implementation Checklist
-
-```jsx
-// Main page structure at /app/chapter[X]/[component-slug]/page.jsx
-import dynamic from 'next/dynamic';
-import TabbedLearningPage from '@/components/ui/TabbedLearningPage';
-import { BookOpen, Target, Zap, [OriginalIcon] } from 'lucide-react';
-
-// Import new tabs from new folder (with tab numbers for clarity)
-const FoundationsTab = dynamic(() =>
- import('@/components/XX-chapter/Y-Y-Y-component-name/Tab1FoundationsTab'), { ssr: false }
-);
-const WorkedExamplesTab = dynamic(() =>
- import('@/components/XX-chapter/Y-Y-Y-component-name/Tab2WorkedExamplesTab'), { ssr: false }
-);
-const QuickReferenceTab = dynamic(() =>
- import('@/components/XX-chapter/Y-Y-Y-component-name/Tab3QuickReferenceTab'), { ssr: false }
-);
-
-// Import original component from its ORIGINAL location (unchanged)
-const [OriginalComponent] = dynamic(() =>
- import('@/components/XX-chapter/Y-Y-Y-ComponentName'), { ssr: false }
-);
-
-export default function [Topic]Page() {
- const TABS = [
- { id: 'foundations', label: 'Foundations', icon: BookOpen,
- component: FoundationsTab, color: '#10b981' },
- { id: 'worked-examples', label: 'Worked Examples', icon: Target,
- component: WorkedExamplesTab, color: '#3b82f6' },
- { id: 'quick-reference', label: 'Quick Reference', icon: Zap,
- component: QuickReferenceTab, color: '#7c3aed' },
- { id: 'original', label: '[Original Display Name]', icon: [Icon],
- component: [OriginalComponent], color: '[original color]' }
- ];
-
- return (
-
- );
-}
-```
-
-## 🎯 Key Principles
-
-1. **ALWAYS Preserve Original Component**: The existing component becomes Tab 4 - never modify it!
-2. **Add Educational Value**: Create 3 new educational tabs that teach the concepts
-3. **Professional Tone**: Treat students as adults learning for careers
-4. **Real Motivations**: Connect to ML/AI/tech industry applications
-5. **Exam Focus**: Use real exam problems without fake statistics
-
-## 🛡️ Critical Best Practices (Prevent Common Errors)
-
-### **React Hooks Rules**
-- **NEVER put hooks inside section content functions** - Always at component top level
-- **Extract section components** - Move hooks to separate components outside arrays
-- **Consistent hook order** - Same hooks called every render regardless of content
-
-### **Hydration Safety**
-- **NO localStorage in useState initializer** - Always start with empty/default state
-- **Load after hydration** - Use `useEffect` to populate from localStorage
-- **Add isHydrated flag** - Track when client-side data is loaded
-- **Conditional progress UI** - Only render completion indicators after hydration
-
-### **Safe Hook Pattern**
-```js
-// ❌ BAD - Hooks in content functions
-const SECTIONS = [{
- content: () => {
- const [state] = useState(); // BREAKS RULES
- return
...
;
- }
-}];
-
-// ✅ GOOD - Hooks at top level
-const SectionComponent = ({ state, setState }) =>
);
-}
\ No newline at end of file
+}
diff --git a/src/app/chapter3/normal-distributions/z-score-explorer/page.js b/src/app/chapter3/normal-distributions/z-score-explorer/page.js
index 32d7eac..1ce51ee 100644
--- a/src/app/chapter3/normal-distributions/z-score-explorer/page.js
+++ b/src/app/chapter3/normal-distributions/z-score-explorer/page.js
@@ -1,7 +1,6 @@
'use client';
import dynamic from 'next/dynamic';
-import BackToHub from '@/components/ui/BackToHub';
import Link from 'next/link';
import { Button } from '@/components/ui/button';
import { ArrowLeft } from 'lucide-react';
@@ -29,12 +28,12 @@ export default function ZScoreExplorerPage() {
-
-
@@ -57,8 +56,14 @@ export default function ZScoreExplorerPage() {
-
+
+
+ The worked example below keeps the mean at 100, the standard deviation at 15,
+ and x at 115. Compare its steps with the values you explore above.
+
+
+
>
);
-}
\ No newline at end of file
+}
diff --git a/src/app/chapter5/sample-size/page.js b/src/app/chapter5/sample-size/page.js
index 9312b1a..40553eb 100644
--- a/src/app/chapter5/sample-size/page.js
+++ b/src/app/chapter5/sample-size/page.js
@@ -1,6 +1,6 @@
'use client';
-import SampleSizeCalculation from "@/components/05-estimation/5-3-SampleSizeCalculation";
+import { SampleSizeLearningPage } from '@/components/05-estimation/5-3-SampleSizeCalculation';
import { Chapter5ReferenceSheet } from '@/components/reference-sheets/Chapter5ReferenceSheet';
export default function SampleSizeCalculationPage() {
@@ -8,8 +8,8 @@ export default function SampleSizeCalculationPage() {
-
+
);
-}
\ No newline at end of file
+}
diff --git a/src/app/globals.css b/src/app/globals.css
index 9233f59..4e6c009 100644
--- a/src/app/globals.css
+++ b/src/app/globals.css
@@ -408,3 +408,28 @@ button {
.animate-flash {
animation: flash 0.6s ease-in-out 2;
}
+
+@media (prefers-reduced-motion: reduce) {
+ html {
+ scroll-behavior: auto !important;
+ }
+
+ *, *::before, *::after {
+ animation-duration: 0.01ms !important;
+ animation-iteration-count: 1 !important;
+ transition-duration: 0.01ms !important;
+ }
+}
+
+/* Start static, then follow the effective device or site preference. */
+html[data-reduced-motion="true"] {
+ scroll-behavior: auto !important;
+}
+
+html[data-reduced-motion="true"] *,
+html[data-reduced-motion="true"] *::before,
+html[data-reduced-motion="true"] *::after {
+ animation: none !important;
+ transition: none !important;
+ scroll-behavior: auto !important;
+}
diff --git a/src/app/layout.js b/src/app/layout.js
index c765850..a60b17d 100644
--- a/src/app/layout.js
+++ b/src/app/layout.js
@@ -1,6 +1,10 @@
import './globals.css';
+import Script from 'next/script';
import { MathJaxProvider } from '../components/shared/MathJaxProvider';
import { LayoutWrapper } from '../components/shared/LayoutWrapper';
+import { MotionPreferenceProvider } from '../components/shared/MotionPreferenceProvider';
+import { ActiveProgressProvider } from '../components/shared/ActiveProgressProvider';
+import { MATHJAX_CONFIG_SCRIPT } from '@/lib/mathjax/config';
export const metadata = {
title: 'Probability Lab - MAT 2377',
@@ -14,13 +18,24 @@ export const viewport = {
export default function RootLayout({ children }) {
return (
-
+
-
-
- {children}
-
-
+
+
+
+
+
+ {children}
+
+
+
+
);
diff --git a/src/app/progress/page.js b/src/app/progress/page.js
new file mode 100644
index 0000000..5e23309
--- /dev/null
+++ b/src/app/progress/page.js
@@ -0,0 +1,10 @@
+import LearningProgressPage from '@/components/progress/LearningProgressPage';
+
+export const metadata = {
+ title: 'Your learning progress - Probability Lab',
+ description: 'Review your study progress and quiz results, and keep a backup of your learning records.',
+};
+
+export default function ProgressPage() {
+ return ;
+}
diff --git a/src/app/resources/formulas/page.jsx b/src/app/resources/formulas/page.jsx
new file mode 100644
index 0000000..aedcec5
--- /dev/null
+++ b/src/app/resources/formulas/page.jsx
@@ -0,0 +1,44 @@
+import Link from 'next/link';
+import { chapters } from '@/config/sidebar-chapters';
+
+export const metadata = {
+ title: 'Formula Reference | Probability Lab',
+ description: 'Find probability and statistics formulas, their conditions, and interactive formula builders by chapter.',
+};
+
+export default function FormulaReferencePage() {
+ const references = chapters.filter(chapter =>
+ chapter.sections.some(section => section.url.endsWith('/formula-builder'))
+ );
+
+ return (
+
+
+
Formula Reference
+
+ Choose a chapter to explore its formulas and work through the interactive builders.
+ Check each formula's assumptions before applying it to a problem.
+
+
+ All learning resources
+
+
+ );
+}
diff --git a/src/app/resources/page.js b/src/app/resources/page.js
index a5577dc..45b96a8 100644
--- a/src/app/resources/page.js
+++ b/src/app/resources/page.js
@@ -10,6 +10,22 @@ import {
} from 'lucide-react';
const resources = [
+ {
+ icon: BookOpen,
+ title: 'Your Learning Progress',
+ description: 'Review your study records and keep a backup of your progress.',
+ link: '/progress',
+ features: ['Study completion', 'Recorded quiz results', 'Backup and restore'],
+ color: 'text-teal-400'
+ },
+ {
+ icon: FileText,
+ title: 'Formula Reference',
+ description: 'Find formulas and interactive builders for each chapter.',
+ link: '/resources/formulas',
+ features: ['Probability distributions', 'Inference and estimation', 'Regression'],
+ color: 'text-blue-400'
+ },
{
icon: GraduationCap,
title: 'Study Tips',
@@ -39,7 +55,7 @@ export default function ResourcesPage() {
Learning Resources
- Everything you need to succeed in probability and statistics
+ Formula builders, prerequisites, and strategies for studying probability and statistics
diff --git a/src/app/terms/page.js b/src/app/terms/page.js
index e6093ed..16f06f5 100644
--- a/src/app/terms/page.js
+++ b/src/app/terms/page.js
@@ -54,8 +54,18 @@ export default function TermsPage() {
4. Privacy
- Your progress data is stored locally in your browser. We do not collect personal information
- unless explicitly provided through contact forms.
+ You can use the lessons without an account, and guest progress stays in this browser.
+ If email sign-in is available and you choose to use it, the authentication provider receives
+ your email address and sign-in information. Completed study records, quiz history and quiz
+ preferences can be saved to your account and synchronized across devices; check the progress
+ page for pending or failed synchronization. Reading positions and unfinished quizzes stay
+ in this browser and are not included in account synchronization.
+
+
+ Adding guest records to an account requires your explicit choice. Signing out does not
+ delete saved account progress or the guest copy in this browser. Clearing browser data can
+ remove guest records, device-only details and account updates that have not synchronized.
+ Backups may contain your progress and account identifiers, so keep them confidential.
@@ -76,7 +86,7 @@ export default function TermsPage() {
-
Last updated: January 2024
+
Last updated: October 3, 2026
For questions about these terms, please contact us.
- Imagine a world where everything is made of tiny pebbles. Each pebble represents a possible outcome,
- and probability is simply counting pebbles.
+ Imagine a bag of pebbles, one for each possible outcome. When all outcomes are equally likely,
+ an event's probability is the fraction of pebbles belonging to that event.
Sample Space
- All possible outcomes = All pebbles in the world
+ All possible outcomes = All pebbles in this bag
- Probability is fundamentally about counting. When all outcomes are equally likely,
- it's just a ratio of favorable outcomes to total outcomes.
+ For a finite sample space with equally likely outcomes, probability is the ratio of
+ favorable outcomes to total outcomes.
- Let's apply everything we've learned to a simple problem: flipping a coin twice.
+ Let's apply everything we've learned to two independent flips of a fair coin.
+ H means heads and T means tails; the first letter records the first flip.
- Every probability problem can be reduced to counting pebbles. This physical intuition
- will guide us through even the most complex scenarios.
+ Counting pebbles gives us a model for finite, equally likely outcomes. Unequally likely outcomes
+ need assigned probabilities. For the continuous models in this course, we use probability densities.
+ The event remains a set of outcomes in each model.
- Physical Check: Out of 52 equally-weighted pebbles,
+ Physical Check: Out of 52 equally likely pebbles,
only 1 satisfies both conditions. Makes perfect sense!
Set operations: Unions, intersections, complements
-
Multiple approaches: Different solution methods
-
Inclusion-exclusion: Avoiding double counting
-
Verification: Cross-checking answers
-
Physical intuition: Concrete mental models
-
-
-
-
-
-
-
- The Magic Number: 2⁵²
-
-
-
- With 52 cards, there are possible events
- (subsets of the sample space). That's:
-
-
-
+
+
+ Transfer the card example to a new setting. Predict each answer before revealing the solution,
+ and explain which selection rule makes your calculation valid.
+
+
+
Transfer 1: A Fair Die
+
+ Roll a fair six-sided die. S = {'{1, 2, 3, 4, 5, 6}'},
+ A = {'{2, 4, 6}'} (even), and B = {'{4, 5, 6}'} (greater than 3).
+ List A ∩ B and A ∪ B, then find their probabilities. Why must the overlap be counted only once?
+
+
+ Reveal die solution
+
+
A ∩ B = {'{4, 6}'}, so P(A ∩ B) = 2/6 = 1/3.
+
A ∪ B = {'{2, 4, 5, 6}'}, so P(A ∪ B) = 4/6 = 2/3.
- That's about 4.5 quadrillion possible events! Yet we can understand them all
- through combinations of basic operations like union, intersection, and complement.
-
-
+
-
-
- Your Probability Foundation
-
-
- You now have a rock-solid foundation in probability thinking:
+
Transfer 2: Count or Weight?
+
+ A bag has one red, one blue, and one green pebble with selection weights 2, 1, and 1.
+ The algorithm selects each pebble in proportion to its weight.
+ Find P(red). Would counting red pebbles out of all pebbles give the right answer?
-
-
-
Mental Model
-
-
Physical pebble selection process
-
Sample spaces as complete inventories
-
Events as collections of outcomes
-
-
-
-
-
Mathematical Tools
-
-
Set operations and their meanings
-
Multiple solution approaches
-
Verification through cross-checking
-
+
+ Reveal weighted solution
+
+
The total selection weight is 2 + 1 + 1 = 4. P(red) = 2/4 = 1/2.
+
Counting would give 1/3 if all three pebbles were equally likely. Here the stated selection rule gives red twice the chance of either other pebble.
+
In the explorer, displayed size encodes selection weight. This model specifies a sampling algorithm; it does not infer a physical probability from mass.
-
+
-
-
- Now you're ready to learn how to translate between everyday English and mathematical notation.
- This "dictionary" will be your key to solving any probability problem you encounter.
-
-
- Think of it as learning to speak two languages about the same simple idea: picking pebbles from a bag.
-
+
The next page connects these event descriptions with mathematical notation.
);
@@ -403,4 +359,4 @@ export default function Tab2WorkedExamplesTab({ onComplete }) {
showHeader={false}
/>
);
-}
\ No newline at end of file
+}
diff --git a/src/components/01-introduction-to-probabilities/01-foundations/Tab3QuickReferenceTab.jsx b/src/components/01-introduction-to-probabilities/01-foundations/Tab3QuickReferenceTab.jsx
index e2bd1c6..41271bc 100644
--- a/src/components/01-introduction-to-probabilities/01-foundations/Tab3QuickReferenceTab.jsx
+++ b/src/components/01-introduction-to-probabilities/01-foundations/Tab3QuickReferenceTab.jsx
@@ -5,6 +5,20 @@ import SectionBasedContent from '@/components/ui/SectionBasedContent';
import { SimpleFormulaCard, SimpleInsightBox } from '@/components/ui/patterns/SimpleComponents';
import { ComparisonTable } from '@/components/ui/patterns/ComparisonTable';
+function PracticeProblem({ id, question, children }) {
+ return (
+
- Equal Mass: Count favorable pebbles ÷ Count total pebbles
+ Equal likelihood: Count favorable outcomes ÷ Count total outcomes
- Unequal Mass: Weight of favorable ÷ Total weight
+ Weighted selection: Sum of favorable selection weights ÷ Sum of all selection weights.
+ Displayed pebble size represents this numeric weight.
- "Red or Blue" means count BOTH red AND blue pebbles, not choose one
+ "Red or Blue" includes every red pebble and every blue pebble. A single draw needs either color.
Common Mistake #3
- Forgetting probabilities must sum to 1
+ Forgetting probabilities of all disjoint outcomes must sum to 1
- If you have 3 outcomes with probabilities 0.6, 0.3, 0.2 - something's wrong!
+ If your complete list has 3 distinct outcomes with probabilities 0.6, 0.3, 0.2 - something's wrong!
- Always return to the physical intuition: "What would happen if I actually had this bag of pebbles?"
+ Name the outcomes, state the selection rule, and check whether equal likelihood is justified.
Predict each answer and explain your selection rule before revealing its solution.
-
Practice Set A: Equal Mass
-
-
1. Bag has 12 red, 8 blue pebbles. Find P(red).
-
2. Standard die. Find P(even number).
-
3. Deck of cards. Find P(heart or spade).
+
Practice Set A: Equally Likely Outcomes
+
+
+ P(red) = 12/20 = 0.6. Every pebble has the same selection probability, so count the 12 favorable outcomes among 20 total.
+
+
+ The even outcomes are {'{2, 4, 6}'}. P(even) = 3/6 = 0.5 because all six faces are equally likely.
+
+
+ Hearts and spades are disjoint suits with 13 cards each. P(heart or spade) = (13 + 13)/52 = 26/52 = 0.5.
+
-
Practice Set B: Unequal Mass
-
-
1. Medical test: 85% accurate. Find P(correct result).
+
+ P(correct result) = 0.85. This is the supplied overall probability for this population; there is no reason to assign correct and incorrect equal probabilities.
+
+
+ P(mobile) = 0.6, the given proportion of mobile visits.
+
+
+ P(not agree) = 1 − 0.7 = 0.3. Both disagree and undecided belong to the complement: 0.2 + 0.1 = 0.3.
+
-
-
-
- Set A: 12/20=0.6, 3/6=0.5, 26/52=0.5
- Set B: 0.85, 0.6, 1-0.7=0.3
-
-
)
}
@@ -190,4 +211,4 @@ export default function Tab3QuickReferenceTab({ onComplete }) {
showHeader={false}
/>
);
-}
\ No newline at end of file
+}
diff --git a/src/components/01-introduction-to-probabilities/01-foundations/Tab4InteractiveTab-StaticVisual.jsx b/src/components/01-introduction-to-probabilities/01-foundations/Tab4InteractiveTab-StaticVisual.jsx
index 87d6246..37ee30c 100644
--- a/src/components/01-introduction-to-probabilities/01-foundations/Tab4InteractiveTab-StaticVisual.jsx
+++ b/src/components/01-introduction-to-probabilities/01-foundations/Tab4InteractiveTab-StaticVisual.jsx
@@ -1,6 +1,6 @@
"use client";
-import React, { useState, useRef } from 'react';
+import React, { useState } from 'react';
import { Button } from '@/components/ui/button';
import { SemanticGradientCard, SemanticGradientGrid } from '@/components/ui/patterns/SemanticGradientCard';
import { SimpleInsightBox } from '@/components/ui/patterns/SimpleComponents';
@@ -8,7 +8,7 @@ import { useMathJax } from '@/hooks/useMathJax';
import SharedNavigation from '../shared/SharedNavigation';
// Pebble Component - Simple circle with color and size
-const Pebble = ({ color, size = 'normal', isSelected = false, onClick, className = '' }) => {
+const Pebble = ({ color, label, size = 'normal', isSelected = false, onClick, className = '' }) => {
const sizeClasses = {
small: 'w-6 h-6',
normal: 'w-8 h-8',
@@ -25,7 +25,10 @@ const Pebble = ({ color, size = 'normal', isSelected = false, onClick, className
};
return (
-
- Notice how your experimental percentages get closer to theoretical probabilities
- as you pick more pebbles (Law of Large Numbers)!
+ Experimental percentages can fluctuate after each draw. Over many independent
+ draws, they tend toward the theoretical probabilities (Law of Large Numbers).
Explore probability through visual experiments with colored pebbles.
- See how equal and unequal masses affect likelihood.
+ Compare uniform draws with draws proportional to assigned selection weights.
- Key Insight: Heavier pebbles are more likely to be selected
+ Key Insight: This model assigns a larger selection probability to a larger numeric weight.
Why weights matter:
- Imagine reaching into the bag blindfolded. Your hand is more likely to grab a heavy pebble
- than a light one because heavy pebbles take up more "selection space."
+ Draw a random number uniformly between 0 and the total selection weight.
+ Give each pebble an interval of length equal to its weight, and select the interval
+ containing the number. A pebble with weight w has probability w divided by the total weight.
+ Visual size encodes that weight; physical mass alone does not determine the probability.
- Light pebbles: {currentBag.light.count} pebbles, each weighing {currentBag.light.weight}
+ Weight-1 group: {currentBag.light.count} pebbles, each with selection weight {currentBag.light.weight}
-
+
-
-
40% chance of drawing a light pebble
+
+
40% chance of drawing from the weight-1 group
@@ -380,18 +413,18 @@ export default function Tab4InteractiveTabStepByStep({ onComplete }) {
{/* Step 3: Calculate Heavy Probability */}
{currentStep >= 3 && (
-
+
- Heavy pebbles: {currentBag.heavy.count} pebbles, each weighing {currentBag.heavy.weight}
+ Weight-3 group: {currentBag.heavy.count} pebbles, each with selection weight {currentBag.heavy.weight}
- Key Insight: Weight dramatically changes probabilities! Even though there are
- more light pebbles (4 vs 2), the heavy pebbles are more likely to be drawn because
- their total weight (6) exceeds the light pebbles' total weight (4).
+ Key Insight: The selection rule changes the answer. Although there are
+ more weight-1 pebbles (4 vs 2), weighted selection favors the weight-3 group because
+ its total selection weight (6) exceeds the other group's total (4).
+ A game can assign selection weights to random item drops and normalize them by their sum.
+ Before using this formula in another setting, check that its sampling rule actually
+ selects outcomes in proportion to those weights.
- You've mastered the step-by-step approach for this scenario. Try another scenario
+ You've completed this calculation. Try another scenario
or move on to the next topic to continue building your probability foundation.
- {onComplete && (
-
- Mark as Complete
-
- )}
)}
);
-}
\ No newline at end of file
+}
diff --git a/src/components/01-introduction-to-probabilities/01-foundations/Tab4InteractiveTab-VennDiagram.jsx b/src/components/01-introduction-to-probabilities/01-foundations/Tab4InteractiveTab-VennDiagram.jsx
index 238004b..999f100 100644
--- a/src/components/01-introduction-to-probabilities/01-foundations/Tab4InteractiveTab-VennDiagram.jsx
+++ b/src/components/01-introduction-to-probabilities/01-foundations/Tab4InteractiveTab-VennDiagram.jsx
@@ -22,8 +22,8 @@ export default function Tab4InteractiveTab({ onComplete }) {
// Set data for two circles (Red and Blue pebbles)
const setData = [
- {name: 'R', label: 'Red Pebbles', cx: 0.35, cy: 0.5, r: 0.25},
- {name: 'B', label: 'Blue Pebbles', cx: 0.65, cy: 0.5, r: 0.25}
+ {name: 'R', label: 'Red Pebbles', cx: 0.3, cy: 0.5, r: 0.23},
+ {name: 'B', label: 'Blue Pebbles', cx: 0.7, cy: 0.5, r: 0.23}
];
// Probability operations for two-set foundations
@@ -360,6 +360,8 @@ export default function Tab4InteractiveTab({ onComplete }) {
setShowProbabilities(!showProbabilities)}
>
{showProbabilities ? "Hide" : "Show"} Values
@@ -370,6 +372,9 @@ export default function Tab4InteractiveTab({ onComplete }) {
{operations.map((op) => (
handleOperation(op)}
className={`
w-full p-3 rounded-lg text-left transition-all duration-200
@@ -433,7 +438,7 @@ export default function Tab4InteractiveTab({ onComplete }) {
{/* Right Panel - Visualization */}
-
+
@@ -442,6 +447,11 @@ export default function Tab4InteractiveTab({ onComplete }) {
Click on regions in the diagram or use the buttons to explore different probability concepts.
This diagram shows how sets represent different colored pebbles in our bag.
+
+ Each pebble has one color, so R ∩ B = ∅ and P(R ∩ B) = 0.
+ Circles show membership; their areas do not represent probabilities.
+ Each of the six pebbles is equally likely to be selected.
+
• Red circle = red pebbles • Blue circle = blue pebbles • Outside = green pebbles
);
-}
\ No newline at end of file
+}
diff --git a/src/components/01-introduction-to-probabilities/01-foundations/Tab4InteractiveTab.jsx b/src/components/01-introduction-to-probabilities/01-foundations/Tab4InteractiveTab.jsx
index cf65770..2848129 100644
--- a/src/components/01-introduction-to-probabilities/01-foundations/Tab4InteractiveTab.jsx
+++ b/src/components/01-introduction-to-probabilities/01-foundations/Tab4InteractiveTab.jsx
@@ -59,9 +59,10 @@ export default function Tab4InteractiveTab({ onComplete }) {
return (
{/* Learning Approach Selector */}
-
+
- Select the approach that works best for your learning style:
+ Use these complementary views to connect experiments, events, and calculations.
+ Changing views starts a new experiment or calculation.
- 🎯 Goal: {15 - interactionCount} more interactions to master standardization!
+ Explore {15 - interactionCount} more parameter changes to reveal a worked engineering example. This counter records exploration, not understanding.
Keep the mean at 100 and x at 115. If the standard deviation changes from 15 to 30, what happens to the z-score and the probability below x?
+
+ Reveal the reasoning
+
The distance from the mean stays 15. Dividing by a standard deviation of 30 gives z = 0.5 instead of 1. The probability below x decreases from about 0.8413 to 0.6915: x is less unusual relative to the wider distribution. Try it with the controls, then explain the change without looking at the formula.
+
+
Now put x below the mean. As the standard deviation increases, does a negative z-score increase or decrease?
+
+ Reveal the negative-score explanation
+
It increases toward zero because its magnitude shrinks. For mean 100 and x = 85, changing the standard deviation from 15 to 30 changes z from −1 to −0.5. The probability below x rises from about 0.1587 to 0.3085. At x equal to the mean, z stays zero and the probability stays 0.5.
+ Bar height is count ÷ (total samples × bin width), so bar area gives the sample proportion.
+ The bars and curve share the density axis; small samples can make tall bars.
+ All retained samples, including points outside the plot, contribute to the total.
+
+ )}
{/* Controls in a horizontal layout below */}
This coarse sum exceeds 1. Refine the grid before interpreting it as a probability.
+ )}
- Calculated using {integrationSteps}×{integrationSteps} = {integrationSteps * integrationSteps} rectangles
+ Calculated using {integrationSteps}×{integrationSteps} subdivisions and {results.subdivisions.total} rectangles
+
The grid gives an approximation for [{formatCalculationNumber(region.x1)}, {formatCalculationNumber(region.x2)}] × [{formatCalculationNumber(region.y1)}, {formatCalculationNumber(region.y2)}]. The uniform and exponential models use independent coordinates; the normal model has standard normal marginals with correlation ρ.
Integration formula:
{
Select a distribution type and adjust parameters
Click and drag on the visualization to select a rectangular region
-
The probability P(X∈A, Y∈B) will be calculated automatically
-
Enable "Show Integration Grid" to see the numerical integration process
+
A grid approximation to P(X∈A, Y∈B) will be calculated automatically
+
Enable "Show Integration Grid" to see the numerical integration process
Increase integration steps for more accurate results
The grid sum approximates the probability over the selected rectangle. Compare it with the closed-form value when available, and refine the mesh to check accuracy.
+
+
+
+ {/* Step-by-Step Explanation */}
+
+
+
+
+ where R is the rectangular region [{formatCalculationNumber(region.x1)}, {formatCalculationNumber(region.x2)}] × [{formatCalculationNumber(region.y1)}, {formatCalculationNumber(region.y2)}]
+
+ Geometric Interpretation: The double integral represents the volume under the surface z = f(x,y) over the region R.
+
+
+
+
+
+ Mesh Refinement: Increasing subdivisions generally improves accuracy, but with diminishing returns and computational cost.
+
+
+
+
+
+ Method Selection: Midpoint is a useful starting rule for smooth densities. Left and right sums bracket the integral when the density is monotone in the same direction in both coordinates throughout the rectangle.
+
+
+
+
+
+ );
+ }, [region, integrationResults]);
// Get distribution formula
const getDistributionFormula = () => {
@@ -559,8 +627,9 @@ export const DoubleIntegralCalculator = () => {
The normal model has standard normal marginals with correlation ρ. The uniform and exponential models use independent coordinates, with positive support widths or rates.