Reference guide

Prompting for STEM math problems

Physics · Optics · Engineering — six techniques and ready-to-copy templates for getting precise, auditable solutions from an AI language model. Built for students, tutors, engineers, and technically curious users who want cleaner setup, better unit tracking, and fewer hidden math mistakes.

Start here

Best general-purpose STEM prompt

Use this when you want one reliable default prompt for physics, optics, engineering, or applied math problems.

You are solving a physics or engineering problem.
1. List knowns and unknowns with units.
2. Identify the governing law or equation.
3. State assumptions and sign conventions.
4. Solve algebraically before substituting numbers.
5. Substitute values with units.
6. Check dimensional consistency and reasonableness.
7. Give the final answer clearly.

Problem: [paste problem here]
Most effective

Show-your-work prompting

Ask the model to show the key intermediate calculations, units, assumptions, and checks before giving the final answer. The goal is not hidden reasoning; the goal is an auditable solution path that makes formula choice, substitutions, and unit handling easier to verify.

Best for

  • Multi-step optics problems (ray tracing, lens equations, interference)
  • Force and moment analysis in structural engineering
  • Circuit analysis with Kirchhoff's laws
  • Any problem where a wrong intermediate result would cascade

Zero-shot trigger phrase

Append this to any question:
"Solve this step by step. Show the governing equations,
substitutions, units, intermediate numerical results,
and final answer. Keep the reasoning concise but
complete enough to audit."

Full CoT template for physics

You are solving a physics problem. Show the work clearly:
1. List all known variables with units.
2. Identify the governing equation(s).
3. State assumptions and sign conventions.
4. Solve algebraically before substituting numbers.
5. Substitute values and compute each step.
6. Check units using dimensional analysis.
7. State the final answer with correct significant
   figures and units.

Problem: [paste your problem here]
Strong for STEM

Step-back prompting

Before solving, ask the model to first identify the underlying physics principles or engineering concepts involved. Grounding in first principles reduces hallucinations and ensures the right formula family is invoked. In the original Step-Back Prompting paper, the method improved PaLM-2L results on MMLU Physics and Chemistry by 7 and 11 percentage points, respectively.

Best for

  • Problems where the right formula isn't obvious (e.g., non-trivial optics setups)
  • Wave optics vs. geometric optics boundary questions
  • Thermodynamics + fluid mechanics combined problems
  • Any problem spanning multiple physics domains

Two-phase template

— Phase 1: Principle extraction —
"You are an expert physicist. What are the fundamental
principles and governing equations relevant to solving
the following problem? Do not solve it yet.

Problem: [your problem]"

— Phase 2: Guided solution —
"Given those principles: [paste Phase 1 output]
Now solve the problem step by step, explicitly
applying each principle you identified."
Sets the register

Role prompting

Assign the model an expert persona relevant to your problem. This steers the model toward domain-specific vocabulary, correct formula selection, and appropriate precision. The more specific the role, the more calibrated the output — "senior optical engineer" elicits different behavior than just "physicist."

Effective role descriptions for STEM

  • "You are a PhD physicist specializing in electromagnetic optics."
  • "You are a licensed structural engineer solving load distribution problems."
  • "You are an optical system designer with expertise in Gaussian beam propagation."
  • "You are a professor teaching engineering mechanics to upper-division undergraduates."

Role + CoT combined template

You are a [ROLE]. A student presents you with the
following problem. Solve it step by step at an
upper-division undergraduate level:
— Identify relevant physical laws.
— Set up the governing equations.
— Solve algebraically, then numerically.
— Verify the answer with a sanity check or
  dimensional analysis.
— Note any assumptions made.

Problem: [your problem]
Pattern matching

Few-shot prompting

Provide one or two fully worked examples before your actual question. The model learns the desired format, level of rigor, and notation style from those examples — extremely useful when you need consistent output structure across a set of similar problems.

Best for

  • Batches of similar problem types (multiple lens problems, beam problems)
  • When you need a specific notation or LaTeX format in the output
  • Teaching yourself — the worked examples become a study resource too
  • Enforcing a strict sign convention across many problems

One-shot optics template

Solve optics problems using this exact format:

EXAMPLE:
Problem: An object is 30 cm in front of a concave
  mirror with focal length 10 cm. Find image distance.
Known: u = -30 cm, f = -10 cm (mirror convention)
Equation: 1/v + 1/u = 1/f
Solve: 1/v = 1/f - 1/u
      = 1/(-10) - 1/(-30)
      = -3/30 + 1/30 = -2/30
Result: v = -15 cm (real image, 15 cm in front)
Check: |m| = |v/u| = 15/30 = 0.5 ✓

Now solve using the same format:
Problem: [your problem]
Computation-heavy problems

Program of thought (PoT) prompting

Ask the model to express the solution as executable Python code rather than prose arithmetic. This offloads numerical computation to an interpreter, eliminating floating-point reasoning errors that LLMs can make. Ideal for problems with many numerical substitutions or iterative calculations.

Best for

  • Ray transfer matrix (ABCD matrix) optics chains
  • Beam deflection with numerical integration
  • Signal processing or Fourier optics calculations
  • Any problem with more than 3–4 numerical substitutions

PoT template

Solve the following engineering/physics problem by
writing Python code.
Requirements:
— Define all known variables with comments
  showing units.
— Use scipy or numpy if needed.
— Print each intermediate result labeled with its
  physical meaning and units.
— Print the final answer clearly.
— Do not use symbolic libraries; compute numerically.

Problem: [your problem]
Reusable structure

Meta prompting

Instead of solving a specific problem, define a reusable procedural template the model should follow for any problem of a given type. Think of it as writing a solver specification rather than a one-off question. Pair it with self-consistency (run the same prompt 2–3 times and compare answers) for high-stakes calculations.

Best for

  • Building a consistent workflow for a recurring problem class
  • When you want to check your own solutions against the model's
  • Complex multi-domain problems (e.g., thermo-optics, opto-mechanics)
  • Setting up a "session" before feeding it a problem set

Meta template — 7-step STEM solver

When I give you a physics or engineering problem,
always follow this procedure:

Step 1 — Classify: identify the domain (mechanics,
  optics, thermodynamics, etc.)
Step 2 — Draw: describe a labeled diagram or
  free-body diagram in words.
Step 3 — Formulate: list all applicable equations
  with variable definitions.
Step 4 — Solve: work algebraically before
  substituting numbers.
Step 5 — Compute: substitute values, track units
  at every step.
Step 6 — Verify: dimensional analysis +
  order-of-magnitude sanity check.
Step 7 — Summarize: one-line result with value,
  units, and direction (if a vector).

Acknowledge this procedure, then wait for my
first problem.

General rules for STEM prompts

Verify important answers independently. For graded work, engineering decisions, or safety-critical calculations, check the final result with a trusted source, calculator, code, or human expert. AI models can still choose the wrong equation, mishandle signs, or make arithmetic mistakes.

Always state units and sign conventions explicitly. Never assume the model will choose your convention. Write "u = −30 cm (object distance, negative = real object)" rather than just "u = 30 cm."

Separate known variables from unknowns. List them before the question: "Given: λ = 550 nm, d = 0.3 mm, L = 1.2 m. Find: fringe spacing Δy."

Request dimensional analysis as a mandatory check. Add: "After computing the final answer, verify it is dimensionally consistent." This catches formula-selection errors before they reach you.

Use self-consistency for critical results. Run the same prompt 2–3 times. If answers diverge, ask the model to identify which step differs and resolve the conflict explicitly.

The 4-phase physics problem-solving model

Building this structure into any prompt aligns the model with how expert physicists actually approach problems — reducing both formula-recall errors and reasoning shortcuts.

Phase 1

Problem representation

Phase 2

Strategy selection

Phase 3

Strategy execution

Phase 4

Evaluation

Solve this problem in 4 phases:
1. Representation — restate the problem in your own
   words, draw a word diagram, list knowns/unknowns.
2. Strategy — identify which law or principle applies
   and why; rule out alternatives.
3. Execution — solve step by step with units
   at every line.
4. Evaluation — does the answer make physical sense?
   Check limiting cases if applicable.

Problem: [your problem]