Skip to content
DeepForgeby svx
All problems
MediumProbabilitypr-382

Two State Chain Stationary Probability

Problem

The stationary distribution of [[1 - a, a], [b, 1 - b]] puts probability b / (a + b) on state 0 (assuming a + b > 0).

Given a and b, return the stationary probability of state 0.

Hint

Balance the flow a pi_0 = b pi_1 with pi summing to one.

Test cases

case 1
in: [0.2,0.3]
expected: 0.6
case 2
in: [0.5,0.5]
expected: 0.5
case 3
in: [1,3]
expected: 0.75
Starter codePython
def two_state_chain_stationary_probability(a, b):
    # Your code here
    pass

3 test cases · run your code against them in the editor