LearnFrenzy
Sign in Take a free test

Core Techniques · Lesson 3 of 5

Step-by-Step Prompting: Getting AI to Reason Before It Answers

For maths, logic and debugging, asking AI to work through the problem before answering makes a real difference. How to do it well, and when it is not needed.

9 min read Intermediate Updated Nov 5, 2026 Reviewed by Saurabh Samir

Give a tricky aptitude question to an AI and ask for "just the answer", and it will sometimes get it wrong. Ask it to work through the problem step by step first, and accuracy usually improves. This is often called chain-of-thought prompting.

Why it helps

An LLM produces its answer one token at a time. If it has to jump straight to "Answer: 42", it has no room to work anything out. When it writes the steps first, each step becomes part of the context for the next one — the model effectively gives itself working space, just like you do with rough work in an exam.

Many newer models have a built-in "thinking" or "reasoning" mode that does this automatically. When it is available, turn it on for hard problems — and you can still ask for the steps to be shown so you can check them.

A simple version

A train 240 m long crosses a platform 360 m long in 30 seconds.
What is the speed of the train in km/h?

Work through it step by step, then give the final answer on its own
line starting with "Answer:".

Asking for the final answer on its own line also makes the response easy to check — you can compare it with the answer key without reading everything.

A guided version

For problems where you know the right method, tell the model which steps to follow:

Debug the Python function below.
1. Explain in one sentence what the function is supposed to do.
2. Trace it with the input [3, 1, 2] and show the value of each
   variable after every loop iteration.
3. Point out where the actual behaviour differs from the expected one.
4. Give the corrected code and explain the fix in one line.

[paste code]

This is far more useful than "why is my code wrong?" because the trace shows you how to find bugs, not just the fix.

When you do not need it

  • Simple factual questions and quick rewrites.
  • Creative writing, where step-by-step reasoning adds nothing.
  • When you want a short answer and speed matters more than depth.

Check the steps, not just the answer

Showing work makes mistakes visible. Read the steps: if one is wrong (a unit not converted, a wrong formula), point to it — "Step 2 is wrong because the platform length must be added" — and ask the model to redo the solution from there. You are training your own reasoning at the same time.

Study trick: after the AI solves a problem step by step, cover the steps and solve it yourself. Then ask the AI for a similar problem with different numbers. This turns a chatbot into a personal aptitude tutor.

Try it yourself: Take three questions from any LearnFrenzy aptitude topic. Ask an AI to solve each one twice — once "answer only", once step by step. Compare with the correct answers on the site.

Common interview questions

Try answering each one aloud before you open it.

1What is chain-of-thought prompting?

Asking the model to reason through intermediate steps before giving the final answer. It improves accuracy on maths, logic and multi-step problems because each step guides the next.

2When is step-by-step reasoning unnecessary?

For simple lookups, quick rewrites or creative tasks where intermediate reasoning does not improve the result and only adds length.

Practise this

Build something with it

FAQs

Do I still need this if my AI tool has a thinking mode?

The thinking mode handles the reasoning internally, but asking to see the key steps is still useful so you can check them.

Can the steps themselves be wrong?

Yes. That is why you should read them — a wrong step is easy to spot and correct once it is written out.

References & further reading

Finished this lesson?

Mark it complete. Create a free account to save it on every device.

Next lesson

Search LearnFrenzy

Esc

Quick links