← All skills
intermediateprompting

Chain-of-Thought (Intro)

Ask the AI to show its reasoning step by step — dramatically improves accuracy on complex tasks.

The Intuition Behind Chain-of-Thought

Language models generate tokens sequentially. Each token is conditioned on everything that came before it. When you ask a model to answer a complex question directly, it has to compress the full reasoning path into its final answer — a high-pressure, error-prone process. Chain-of-thought (CoT) prompting solves this by encouraging the model to externalise the intermediate reasoning steps. Each step in the chain provides additional context that makes the next step more accurate, much like how showing your work on a maths exam helps you avoid arithmetic errors.

The Magic Phrase

The simplest CoT trigger is adding "Let's think step by step" or "Think through this carefully before answering" to your prompt. This single addition, documented in research by Google Brain (Wei et al., 2022), produces measurable improvements on reasoning tasks. The model interprets this instruction as a signal to produce a reasoning trace before committing to an answer. You can also elicit CoT by example — showing a few-shot example where the solution is worked out step by step teaches the model to follow the same pattern.

When It Helps Most

CoT prompting pays off most on tasks that involve multi-step reasoning: mathematical word problems, logical deduction, causal reasoning chains, and planning tasks where the answer depends on correctly sequencing intermediate steps. It helps less on tasks that are already simple or that require only knowledge retrieval — asking the model to think step by step about the capital of France just adds unnecessary verbosity. Apply it selectively where the reasoning path is non-trivial.

Practical Patterns

  • Zero-shot CoT: Append "Let's think step by step." to any prompt.
  • Few-shot CoT: Include 2–3 worked examples showing full reasoning traces before the question.
  • Constrained CoT: Ask the model to reason, then produce a final answer in a specific format: "Think step by step, then give your final answer as a single number."

Example

Q: A bat and ball cost $1.10. The bat costs $1 more than the ball. How much is the ball? A: Let me think step by step. If the ball costs X, the bat costs X+1. Together: X + (X+1) = 1.10, so 2X = 0.10, X = $0.05. The ball costs 5 cents.

Try this skill with our AI assistant

Try it →