School/Prompt Engineering/Advanced Prompting
1/5
Wave 210 minintermediate

Chain of Thought Prompting

Make AI think step-by-step for dramatically better reasoning.

Chain of Thought Prompting

Want AI to solve complex problems reliably? Four words can transform the quality of the output: "Think step by step." This simple technique dramatically improves reasoning on any task that involves multiple steps, calculations, or logical dependencies.

Watch: 3Blue1Brown — How might LLMs store facts (why step-by-step helps reasoning)

Key Concept

Chain of thought (CoT) prompting forces the AI to show its work rather than jumping straight to an answer. This single technique reduces reasoning errors more than almost any other prompting strategy.

The Problem

Without chain of thought, AI often takes shortcuts and jumps straight to an answer -- sometimes getting it wrong:

Prompt: "If a store has a 25% off sale, and you have a 10% member discount applied after the sale price, how much do you pay for a $80 item?"

AI might say: "$52" (wrong -- it might just subtract 35%)

The AI sees two percentages and a price, and it takes the fastest path to an answer. That shortcut leads to the wrong result because the discounts are sequential, not additive.

The Fix

Add "Think step by step" or "Show your reasoning":

"If a store has a 25% off sale, and you have a 10% member discount applied after the sale price, how much do you pay for an $80 item? Think step by step."

AI response:

Step 1: Original price = $80

Step 2: 25% sale discount = $80 x 0.25 = $20

Step 3: Sale price = $80 - $20 = $60

Step 4: 10% member discount on sale price = $60 x 0.10 = $6

Step 5: Final price = $60 - $6 = $54

The correct answer is $54, not $52. And because the AI showed its work, you can verify each step yourself.

Why It Works

Chain of thought forces the AI to:

  1. 1Break the problem into sub-steps
  2. 2Show intermediate results (which you can check)
  3. 3Avoid shortcut errors
  4. 4Handle multi-step logic correctly
Pro Tip

Chain of thought is not just for math. It works for any task where the AI needs to reason through multiple factors. Try it with "Should I take this job offer?" or "What is causing this bug in my code?" -- you will get much more thorough analysis.

Trigger Phrases

Any of these work:

  • "Think step by step"
  • "Walk me through your reasoning"
  • "Show your work"
  • "Break this down into steps"
  • "Let's solve this systematically"
  • "First, ... Then, ... Finally, ..."

When to Use It

  • Math and calculations
  • Logic puzzles
  • Complex analysis
  • Decision-making with multiple factors
  • Code debugging
  • Any multi-step problem
Watch Out

Chain of thought adds length to the output, which means it uses more tokens and takes longer to generate. For simple factual questions like "What is the capital of France?" it is unnecessary overhead. Save it for problems where reasoning actually matters.

Advanced: Structured Chain of Thought

For really complex problems, do not just say "think step by step" -- give the AI a specific reasoning structure to follow. This is like providing a worksheet instead of a blank page.

"Analyze whether we should expand into the European market.

Structure your analysis:

1. First, list the key factors to consider

2. For each factor, assess the opportunity and risk

3. Then weigh the factors against each other

4. Finally, give a recommendation with confidence level"

Example

Here is a structured CoT prompt for debugging:

"My e-commerce checkout page is showing a blank screen after users click 'Place Order.' Debug this systematically:

1. List the most likely causes in order of probability

2. For each cause, describe what evidence would confirm or rule it out

3. Suggest the single fastest diagnostic step I should try first

4. If that step reveals the issue, provide the fix"

This structured approach prevents the AI from jumping to a single guess and instead produces a comprehensive diagnostic plan.

Exercises

0/3
Prompt Challenge+15 XP

Ask AI this math problem with AND without chain of thought: "A restaurant bill is $156. You want to leave a 20% tip, then split the total equally among 4 people. How much does each person pay?" Compare the answers.

Hint: Try the plain question first, then add "Think step by step." The answer should be $46.80.

Quiz+5 XP

Chain of thought prompting is MOST useful for:

Reflection+15 XP

Create a prompt that uses structured chain of thought to analyze a business decision you're facing (real or hypothetical). Include at least 4 reasoning steps.

Hint: Think about a decision with multiple factors: cost, time, risk, potential reward, etc.