a = numpy.array([[-1, 0, 0.5, 0, 0, 0], [0.5, -1, 0, 0.5, 0, 0], [0, 0.5, 
    -1, 0, 0.5, 0], [0, 0, 0.5, -1, 0, 0.5], [0, 0, 0, 0, 1, 0], [0, 0, 0, 
    0, 0, 1]])
b = numpy.array([0, 0, 0, 0, 1, 1])
x = numpy.linalg.solve(a, b)
print(x)
How to solve recurrence relations in python