---
title: "Coke-Pepsi Markov model, 4th purchase"
subject: "Simulation and Modeling"
chapter: 5
key: "semester_8/simulation_and_modeling:markov-coke-pepsi-4th-purchase"
source: https://www.bctengineer.com/q/semester_8/simulation_and_modeling/markov-coke-pepsi-4th-purchase
site: BCT Engineering
---

# Coke-Pepsi Markov model, 4th purchase

Simulation and Modeling · Chapter 5: Markov chains

- Asked in: 2074 Magh, 2×3 marks
- Video: [Markov Chains Clearly Explained! Part - 1](https://www.youtube.com/watch?v=i3AkTO9HLXo) — Normalized Nerd
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_8/simulation_and_modeling/markov-coke-pepsi-4th-purchase
- Whole chapter: https://www.bctengineer.com/md/semester_8/simulation_and_modeling/chapter-5

## Question

Design markov model and transition matrix for given data. Answer following questions based on the model.
a. If a person purchase coke now the probability of purchase of coke next time is 80%.
b. If a person purchase pepsi now the probability of purchasing pepsi next time is 70%.
Problems:
i. Find the probability of using coke for a current pepsi user in 4th purchases.
ii. Find the probability for a person using pepsi now for a current pepsi purchaser after 4 purchases.
iii. A population of 5250 (out of 10200) in a study of soft drink user uses coke now, find the population of purchasing pepsi in 4th purchases.

## Short answer

Compute the four-step transition matrix P^4. (i) Probability a Pepsi user buys Coke in the 4th purchase is 0.5625. (ii) Probability a Pepsi user buys Pepsi is 0.4375. (iii) With 5250 Coke and 4950 Pepsi users initially, after four purchases about 4134 people buy Pepsi.

## Answer

**Assumption**: "4th purchase" means four transitions from the current purchase, so P^4 is used. States: C = Coke, P = Pepsi.

#### Markov model

```text
        0.2
   +----------->+
 (C)             (P)
 0.8 loop        0.7 loop
   +<-----------+
        0.3
```

- Coke user: stays Coke 0.8, moves to Pepsi 0.2.
- Pepsi user: stays Pepsi 0.7, moves to Coke 0.3.

Transition matrix (rows = from, columns = to):

| From \ To | Coke | Pepsi |
|---|---|---|
| Coke | 0.8 | 0.2 |
| Pepsi | 0.3 | 0.7 |

#### Powers of P

- P^2: Coke row = [0.64 + 0.06, 0.16 + 0.14] = [0.70, 0.30]; Pepsi row = [0.24 + 0.21, 0.06 + 0.49] = [0.45, 0.55]
- P^3 = P^2 x P: Coke row = [0.70 x 0.8 + 0.30 x 0.3, 0.70 x 0.2 + 0.30 x 0.7] = [0.65, 0.35]; Pepsi row = [0.45 x 0.8 + 0.55 x 0.3, 0.45 x 0.2 + 0.55 x 0.7] = [0.525, 0.475]
- P^4 = P^3 x P: Coke row = [0.65 x 0.8 + 0.35 x 0.3, 0.65 x 0.2 + 0.35 x 0.7] = [0.625, 0.375]; Pepsi row = [0.525 x 0.8 + 0.475 x 0.3, 0.525 x 0.2 + 0.475 x 0.7] = [0.5625, 0.4375]

P^4 = [[0.625, 0.375], [0.5625, 0.4375]]

#### (i) Pepsi user, Coke in the 4th purchase

p(Pepsi to Coke) = **0.5625**

#### (ii) Pepsi user, Pepsi in the 4th purchase

p(Pepsi to Pepsi) = **0.4375**

#### (iii) Population of Pepsi buyers in the 4th purchase

Coke users now = 5250, so Pepsi users now = 10200 - 5250 = 4950.

Pepsi after 4 purchases = 5250 x p(C to P) + 4950 x p(P to P)
= 5250 x 0.375 + 4950 x 0.4375 = 1968.75 + 2165.63 = 4134.4

About **4134 people** will buy Pepsi (and 10200 - 4134 = 6066 will buy Coke).

## Check yourself

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

1. What is the matrix with rows Coke, Pepsi?
   A. [[0.8, 0.2], [0.3, 0.7]]
   B. [[0.8, 0.2], [0.7, 0.3]]
   C. [[0.2, 0.8], [0.7, 0.3]]
   D. [[0.8, 0.3], [0.2, 0.7]]
   Answer: A. Coke stays 0.8 and goes to Pepsi 0.2; Pepsi stays 0.7 and goes to Coke 0.3. (Key point: Transition matrix)

2. How many transitions are used for the 4th purchase?
   A. Three, so P^3
   B. Four, so P^4
   C. One, so P
   D. Five, so P^5
   Answer: B. The answer takes 4th purchase as four transitions. (Key point: Power of P)

3. What is the probability a Pepsi user buys Coke in the 4th purchase?
   A. 0.4375
   B. 0.375
   C. 0.5625
   D. 0.625
   Answer: C. It is the Pepsi-to-Coke entry of P^4 = [[0.625, 0.375],[0.5625, 0.4375]]. (Key point: Pepsi user to Coke)

4. Coke users now are 5250 of 10200. How is the Pepsi population after 4 purchases computed?
   A. 5250 x 0.625 + 4950 x 0.5625, about 6066
   B. 5250 x 0.2 + 4950 x 0.7, about 4515
   C. 5250 x 0.4375 + 4950 x 0.375, about 4153
   D. 5250 x 0.375 + 4950 x 0.4375, about 4134
   Answer: D. Pepsi users now are 10200 - 5250 = 4950; add the contributions to Pepsi from both groups. (Key point: Population)

## Related in Simulation and Modeling

- [Coke-Pepsi Markov diagram, 3rd purchase](https://www.bctengineer.com/question.md?key=semester_8%2Fsimulation_and_modeling%3Amarkov-coke-pepsi-diagram) — Simulation and Modeling, chapter 5
- [Pepsi user buying Coke, third purchase](https://www.bctengineer.com/question.md?key=semester_8%2Fsimulation_and_modeling%3Amarkov-pepsi-coke-third) — Simulation and Modeling, chapter 5
- [Sony-Samsung Markov, 80/85, 60% users](https://www.bctengineer.com/question.md?key=semester_8%2Fsimulation_and_modeling%3Amarkov-sony-samsung-80-85) — Simulation and Modeling, chapter 5
- [Honda-Yamaha Markov, key features](https://www.bctengineer.com/question.md?key=semester_8%2Fsimulation_and_modeling%3Amarkov-honda-yamaha) — Simulation and Modeling, chapter 5
- [Nokia-Samsung Markov, two purchases](https://www.bctengineer.com/question.md?key=semester_8%2Fsimulation_and_modeling%3Amarkov-nokia-samsung) — Simulation and Modeling, chapter 5, asked 2×

## Related in other subjects

- [Money transfer sequence diagram questions](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Amoney-transfer-sequence-diagram) — Object Oriented Analysis and Design, chapter 2
