Continued Fractions and Weighted Mediants 

Wherefore, my beloved, as ye have always obeyed, not as in my presence only, but now much more in my absence, work out your own salvation... 
Philippians, 2:12 

A simple continued fraction for the quantity x is an expression of the form 



where the a_{j} coefficients are ordinarily positive integers. The convergents of this continued fraction are defined as the partial results 



and so on. Each convergent x_{n} can be written as a simple fraction p_{n}/q_{n} where 



Notice that x_{2} can be expressed as 



Furthermore, it’s clear from the definitions of the convergents that if we have an expression for x_{n} in terms of a_{0}, a_{1}, ..., a_{n}, then the value of x_{n+1} is given by simply replacing a_{n} with a_{n} + 1/a_{n+1}. Thus, for example, we can write x_{3} using the above expression for x_{2} as follows 



By induction it follows that 



for all n > 1. Thus each convergent of a simple continued fraction is the weighted mediant of the previous two convergents. This is depicted in the figure below for the first three convergents of the simple continued fraction for the square root of 2: 



In this case the coefficients are a_{0} = 1 and a_{j} = 2 for all j>0. In general, the convergents always alternate on either side of the asymptotic value, because the weighted mediate is always between the two arguments. Notice that it a_{n} were equal to zero, then x_{n} would equal x_{n−2}, whereas for positive values of a_{n} the value of x_{n} is weighted toward x_{n−1} (and approaches x_{n−1} as a_{n} goes to infinity). The coefficient a_{n} is always the largest integer such that x_{n} is still on the opposite side of the asymptotic value from x_{n−1}. 

A similar approach can be taken to evaluating more general forms of continued fractions. For example, consider a continued fraction of the form 



The first few convergents are 



Therefore, letting x_{n} = p_{n}/q_{n} for the ratios written in this form, we have 



By similar reasoning to our analysis of simple continued fractions, we can say that the expression for x_{3} is given by replacing a_{2} in this expression with a_{2} + b_{3}/a_{3}. This leads to 



Again by induction it follows that, in general, we have 



for all n > 1. This shows (again) that each convergent is a weighted mediant of the two prior convergents. 

As an example, suppose we wish to evaluate the area under the upper tail of the normal curve from some u to infinity using Laplace’s expression 



We can evaluate the numerator (the quantity in parentheses) directly, so it only remains to determine the value of the continued fraction in the denominator. For this we have a_{j} = u and b_{j} = j for all j. Thus beginning with the initial values p_{0} = u and p_{1} = u^{2}+1 we can compute all subsequent values of p_{j} using the recurrence p_{n} = up_{n−1} + np_{n−2}. Likewise we have the initial values q_{0} = 1 and q_{1} = u, and we can compute all subsequent values of q_{j} using the recurrence q_{n} = uq_{n−1} + nq_{n−2}. To illustrate, with u = 3 we get 



Thus we can recursively compute the denominator in Laplace’s formula to any desired precision. 
