# Solving a boundary-value recurrence relation

I would like to solve a recurrence relation of the form

RSolve[
{
h[n] == p[n]*h[n + 1] + q[n]*h[n - 1] + (1 - p[n] - q[n])*h[n]
,h[1] == 0.5
,h[Nn]==0.5*h[Nn-1]
}, h[n], n]


where Nn is some boundary condition. This runs and produces a solution, but it doesn't understands that the Nn is the upper bound for n, how can I supply this constraint?

• What difference does it make if Nn is upper or not upper if Mma gives answer for all values of n? – Andrew Apr 11 '18 at 12:10
• I can swap 'Nn' in when I see n in the answer indeed, but perhaps a neater formula would be spit out with fixing the boundary – Three Diag Apr 11 '18 at 12:14