ScopeTreasure.

Back

Prompt Engineering Courses · Lesson PE.6

Step-by-Step Thinking

CODE SCOPE PROMPT ENGINEERING SERIESLESSON PE.6 OF PE.1–PE.12

Hard problems need slow thinking. Make the AI reason out loud, step by step, and check its own work.

Free PDF of this lesson — save it, print it, revise offline. The video is the same lesson on the Code Scope YouTube channel.

Introduction

Ask an AI a hard question — a maths word problem, a logic puzzle, a multi-part decision — and it often jumps straight to an answer. Sometimes the answer is right. Often it is confidently wrong, because the AI skipped the working. The fix is simple: make it show its thinking, step by step, before it answers.

When the AI reasons out loud, two good things happen. First, each small step is easy, so fewer mistakes creep in. Second, you can SEE where it went wrong and correct that one step, instead of throwing the whole answer away. This is the single most useful technique for maths, logic, code and planning.

(Roman Urdu: Mushkil sawal par AI seedha jawab de deta hai — aur aksar ghalat. Usay step by step sochne ko kaho: har chhota step asaan hota hai, aur ghalti nazar bhi ajati hai.)

Key points

  • "Think step by step" is a real instruction, not a magic phrase. It tells the AI to break the problem into small steps and write each one down before concluding.
  • Use it for multi-step problems: maths, logic, planning, code debugging, comparisons with several factors. For simple facts ("capital of France?") it adds nothing — skip it.
  • Ask for the working AND the final answer separately. "Show each step, then give the final answer on its own last line" makes checking easy.
  • Add self-checking for important answers. "After your answer, check each step once more and say if any step is wrong" catches mistakes the first pass missed.
  • Break the problem yourself when it is big. One prompt per part beats one giant prompt: first the plan, then each part, then the combination.
  • If a step is wrong, correct only that step. Reply with "Step 3 is wrong because..." and let the AI redo from there. This is faster than starting over, and it is the core of lesson PE.8.
  • Step-by-step does not guarantee correctness. It reduces mistakes a lot, but a confident wrong step is still possible. For exams, money and code, verify the final answer yourself.
  • Beginners get stuck when the chain is too long. If the steps run past 8–10 lines, the AI starts drifting. Fix: stop the chain and ask for the next part separately — "Now continue from step 5" works better than one 20-step answer.
  • Ask for units and labels inside the steps. "Cost = Rs 7200" is checkable; a bare "7200" is not. Named lines (cost, selling price, profit) let you spot the wrong line in seconds, even in a long chain.

Examples

Example 1 — A maths word problem, without and with steps

Without steps:

A shopkeeper buys 12 shirts for Rs 600 each and sells them at Rs 750 each. What is his total profit?

The AI may answer directly — sometimes right, sometimes with a slipped number you cannot trace.

With steps:

Solve step by step. Show each step on its own line, then give the final answer on its own last line. Problem: A shopkeeper buys 12 shirts for Rs 600 each and sells them at Rs 750 each. What is his total profit?

What you will get: cost (12 × 600 = 7200), selling total (12 × 750 = 9000), profit (9000 − 7200 = 1800), then "Final answer: Rs 1800." Every number is checkable, and a mistake would be visible in exactly one line.

Example 2 — A decision with several factors

I have Rs 5000. I need a phone for study: video classes, notes, and WhatsApp. Help me decide step by step: first list what matters for study use, then compare a used phone vs a new budget phone on those points, then recommend one and say why. End with one line: your recommendation.

Why steps matter here: a direct answer ("Buy X") hides the reasoning. Step-by-step shows the criteria, the comparison, and the recommendation — so you can disagree with a criterion instead of blindly following a verdict.

Example 3 — Debugging code, step by step

This JavaScript code should print numbers 1 to 5, but it prints nothing. Go through it line by line, say what each line does, find the line that breaks it, and explain the fix in one sentence. Code:
for (let i = 1; i > 5; i++) {
  console.log(i);
}

What you will get: a line-by-line walk that spots i > 5 (the condition is backwards on the first check) instead of a vague "your loop is wrong". The steps do the diagnosis for you.

Example 4 — Before and after: a percentage problem

Without steps:

A shopkeeper gives 20% discount on a shirt priced Rs 1000, then adds 10% tax on the discounted price. What does the customer pay?

With steps:

Solve step by step, one step per line, with a label for each step. Then give the final answer on its own last line. Problem: A shopkeeper gives 20% discount on a shirt priced Rs 1000, then adds 10% tax on the discounted price. What does the customer pay?

The step version shows: discount (20% of 1000 = 200), price after discount (800), tax (10% of 800 = 80), final price (880). A direct answer hides the trap — tax is on the discounted price, not the original. The steps make the trap visible.

Example 5 — Step-by-step for a plan, not just maths

I have 3 hours to revise 3 chapters before tomorrow's test. Plan step by step: first rank the chapters by how weak I am in each, then divide the 3 hours across them, then list what to do in each slot (read, practise, or test). End with a timetable table.

Planning is also a multi-step problem: ranking, dividing, listing. Without steps the AI gives a timetable with no reasoning, and you cannot tell whether the weak chapter got the most time. With steps, the reasoning is on the page.

Example 6 — Catching a right answer with a wrong step

Problem: "A train travels 60 km in 1 hour. How far in 2.5 hours?" The AI answers "150 km" — correct. But its steps say "60 × 2.5 = 120, plus 30 = 150". The final answer is right and the working is broken. That is why this lesson says: read the steps, not just the last line. A lucky final answer teaches nothing, and the same broken step fails on the next problem.

Real-world case — Where this is actually used

Accountants and shopkeepers check AI calculations the same way teachers check students: by the working, not the total. A shop owner who asks for "cost, discount, tax, final price, one line each" can spot a wrong tax line before it reaches a customer bill. In coding, the same habit — "explain what each line does, then find the broken line" — is how beginners debug programs they did not write, instead of guessing.

Quick recap

  • Hard problems: make the AI think out loud, step by step, before answering.
  • Ask for working plus a final answer on its own last line.
  • Add a self-check for important answers.
  • Big problems: split into parts, one prompt per part.
  • Correct the wrong step only, not the whole answer.
  • Steps reduce mistakes — they do not remove the need to verify.

Common mistakes

  1. Asking for steps on simple facts — "Think step by step: capital of France?" wastes time and can even add confusion. Fix: use steps only for multi-step problems.
  2. Accepting a long chain without checking — a wrong early step poisons every later step. Fix: read the steps, especially the first two.
  3. One giant prompt for a giant problem — the chain gets too long and drifts. Fix: split the problem, solve part by part.
  1. Steps without a final answer line — a long chain that ends mid-thought leaves you hunting for the answer. Fix: always add "give the final answer on its own last line".
  2. Correcting the whole chain instead of one step — "This is all wrong, do it again" throws away good steps too. Fix: name the step number and the error, and ask it to redo from that step only.

Practice

  1. Take a maths word problem from your book. Ask it twice: once directly, once with "solve step by step, final answer on its own last line". Compare the two answers — which one can you check?
  2. Deliberately give the AI a problem where you know the answer. Read its steps and find whether any step is wrong even though the final answer is right. (This happens more often than people think.)
  1. Take a two-step problem from your maths book. Ask it directly and step by step, then check: did the direct answer hide any step you could not verify?
  2. Give the AI a problem where you already know the answer, but read only its steps. Find one step you disagree with — even if the final answer is right — and write a one-line correction for that step.
  3. Plan a real task (revision evening, small event, shopping trip) with a step-by-step prompt: rank, divide, list. Check whether the plan's reasoning is visible enough for you to change one part without redoing the whole plan.

Practice quiz

Practice questions — try them, then check your answers in the interactive quiz on the full lesson page.

1. When is 'think step by step' most useful?

  • For simple facts like capitals
  • For multi-step problems: maths, logic, planning, debugging
  • For greetings
  • It is never useful

2. Why ask for the working AND the final answer separately?

  • To make the answer longer
  • So you can check each step and spot exactly where a mistake happened
  • Because the AI refuses otherwise
  • To use more words

3. A step in the AI's chain is wrong. What is the best reply?

  • Start a completely new question
  • Correct only that step, naming it: 'Step 3 is wrong because...'
  • Say 'wrong, try again' with no detail
  • Accept it, the final answer matters more

The interactive quiz with instant green/red answers lives on the full lesson page.