---
title: "Backward chaining with example"
subject: "Artificial Intelligence"
chapter: 4
key: "semester_6/artificial_intelligence:backward-chaining-example"
source: https://www.bctengineer.com/q/semester_6/artificial_intelligence/backward-chaining-example
site: BCT Engineering
---

# Backward chaining with example

Artificial Intelligence · Chapter 4: Knowledge Representation, Inference & Reasoning

- Asked in: 2071 Bhadra, 7 marks
- Video: [Backward chaining example  | AI | Artificial intelligence | Lec-40 | Bhanu Priya](https://www.youtube.com/watch?v=6DU42so8k48) — Education 4u
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/artificial_intelligence/backward-chaining-example
- Whole chapter: https://www.bctengineer.com/md/semester_6/artificial_intelligence/chapter-4

## Question

Explain Backward Chaining with suitable example.

## Short answer

Backward chaining is goal-driven: start with goal, find rules with matching conclusion, prove conditions as sub-goals recursively. Example: goal green(Fritz) uses rule frog→green, sub-goal frog(Fritz) uses rule croaks∧eats_flies→frog, sub-goals croaks(Fritz) and eats_flies(Fritz) are facts, proving goal.

## Answer

**Backward chaining** is a goal-driven reasoning method used in rule-based systems. It starts with the **goal (hypothesis)** and works backwards: it finds rules whose THEN part (conclusion) matches the goal, and then tries to prove the IF parts (conditions) of those rules as new **sub-goals**. A sub-goal is proved if it is a known fact, or if it can in turn be proved by another rule. If a sub-goal cannot be proved and cannot be asked from the user, the rule fails and another rule is tried (backtracking). Prolog and MYCIN use backward chaining.

#### Algorithm
```text
prove(goal):
  if goal is in the fact base -> return TRUE
  for each rule whose conclusion matches goal:
      if prove(every condition of the rule) -> return TRUE
  return FALSE
```

#### Example
Rules:
- R1: IF X croaks AND X eats flies THEN X is a frog
- R2: IF X chirps AND X sings THEN X is a canary
- R3: IF X is a frog THEN X is green
- R4: IF X is a canary THEN X is yellow

Facts: Fritz croaks. Fritz eats flies.

**Goal:** Is Fritz green?

| Step | Goal / sub-goal | Action |
|---|---|---|
| 1 | green(Fritz)? | Not a fact; rule R3 concludes "green": new sub-goal frog(Fritz) |
| 2 | frog(Fritz)? | Not a fact; R1 concludes "frog": sub-goals croaks(Fritz), eats_flies(Fritz) |
| 3 | croaks(Fritz)? | Known fact: TRUE |
| 4 | eats_flies(Fritz)? | Known fact: TRUE |
| 5 | R1 conditions satisfied | frog(Fritz) is TRUE |
| 6 | R3 condition satisfied | green(Fritz) is TRUE |

```text
green(Fritz)
   |  R3
frog(Fritz)
   |  R1
   +-- croaks(Fritz)     [fact]
   +-- eats_flies(Fritz) [fact]
```
**Result:** The goal is proved: Fritz is green. Rules R2 and R4 are never examined, which shows why backward chaining is efficient when there is a specific goal.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Where does backward chaining start?
   A. With the goal, finding rules whose THEN part matches it
   B. With the known facts, firing every rule whose IF part holds
   C. With the rule that has the most conditions
   D. With a random rule in the rule base
   Answer: A. Backward chaining is goal-driven: it works from the hypothesis back to facts. (Key point: Goal-driven idea)

2. In backward chaining, what happens to the IF conditions of a rule that concludes the goal?
   A. They are added directly as facts
   B. They are ignored once the rule is chosen
   C. They become new sub-goals to be proved
   D. They are negated and resolved
   Answer: C. Each IF condition is a sub-goal, proved from facts or by another rule. (Key point: Sub-goals)

3. To prove green(Fritz), which rules are used and which are never examined?
   A. R2 and R4 are used; R1 and R3 are not
   B. R3 and R1 are used; R2 and R4 are never examined
   C. All four rules must be tried
   D. Only R3 is used; R1 is skipped
   Answer: B. green needs R3 (frog), frog needs R1 (croaks, eats flies); canary rules are irrelevant, showing efficiency. (Key point: Fritz example)

## Related in Artificial Intelligence

- [Forward vs backward chaining](https://www.bctengineer.com/question.md?key=semester_6%2Fartificial_intelligence%3Aforward-vs-backward-chaining) — Artificial Intelligence, chapter 4, asked 3×
- [Rule based reasoning; backward chaining](https://www.bctengineer.com/question.md?key=semester_6%2Fartificial_intelligence%3Arule-based-reasoning-backward-chaining) — Artificial Intelligence, chapter 4
