Prompt Engineering Fundamentals / Prompt Optimization

Chain of Thought (CoT)

Intermediate [3/5]
Step-by-step reasoning Sequential decomposition Explicit reasoning

Definition

Chain of Thought (CoT) prompting encourages the model to break down complex problems into intermediate reasoning steps before arriving at a final answer. Instead of jumping to conclusions, the model "thinks out loud."

This technique dramatically improves performance on math, logic, and multi-step reasoning tasks by making the reasoning process explicit and verifiable.

Key Concepts

  • Step-by-step: Breaking problems into sequential steps
  • Intermediate reasoning: Showing work, not just answers
  • Explicit thinking: Making the reasoning process visible
  • Error detection: Easier to spot where reasoning went wrong

Examples

Without CoT
Direct Answer (Often Wrong)
Q: A store has 23 apples. They sell 8 and receive a shipment of 15. How many do they have? A: 38 ← Wrong! No reasoning shown.
Quick answers without reasoning are prone to errors.
With CoT
Step-by-Step Reasoning
Q: A store has 23 apples. They sell 8 and receive a shipment of 15. How many do they have? A: Let me work through this step by step: 1. Starting apples: 23 2. After selling 8: 23 - 8 = 15 3. After shipment of 15: 15 + 15 = 30 The store has 30 apples. ✓
Each step is shown, making the reasoning verifiable and correct.
Zero-Shot CoT
The Magic Phrase
Simply add to your prompt: "Let's think step by step." or "Let's work through this carefully." This triggers CoT reasoning without examples!
Adding this phrase can improve reasoning on complex tasks.

Interactive Exercise

🧠
Practice Chain of Thought

Solve this problem using Chain of Thought reasoning:

Problem: A movie theater has 120 seats. On Monday, it was 75% full. On Tuesday, 20 more people came than Monday. How many empty seats were there on Tuesday?

Show each step of your reasoning clearly.

Pro Tips
  • Add "Let's think step by step" to trigger CoT reasoning
  • Provide CoT examples in few-shot prompts for best results
  • More effective for complex reasoning than simple tasks
  • CoT can increase token usage significantly

Related Terms