Probability Runs Paper is produced in a continuous process. Suppose that a brightness measurement is made on the paper once every half hour. We have fifteen measurements. The data was entered into R and the following results were produced. The median brightness is 3.2. We will define a value as high (H) if it is greater or equal to the median and as low (L) if it is smaller than the median. 
"L" "L" "L" "H" "H" "H" "H" "H" "H" "L" "H" "H" "H" "L" "L" 
a) In terms of the observed H's and L's, there are how many runs?
b) Let r be the number of runs from part a) Assuming that the manufacturing process is under statistical quality control (i.e permutations of the observed H's and L's are equally likely), what is the probability to observe exactly r runs? 
I know how to solvate problem for part a) There are 3 runs of lows and 2 runs of high. 
I have no idea how to start part b) because we are looking at r runs. Am i looking for both high and low runs? I don't know where to start with this problem.
 A: In the example there are 5 runs of high or low results (3 of low runs, 2 of high runs).
To obtain exactly $r$ runs there must be $r-1$ of the $15-1$ measures after the first where the result changes from the preceding result. (That is, the start of a new run.)   As any run is equally likely to become the start of a new run (conditioned on run composition), then we use a combinatorial argument to obtain the probability.
The first measure sets the pattern.   However, the probability that a result is above the median is $1/2$, by definition of median value.   So we don't need to condition on the first result.
$$\mathsf P(R=r) \quad=\quad \binom{14}{r-1}\;\frac{1}{2^{14}} \qquad [r\in\{1,.. 15\}]$$
A: Provided that the probabilities of L and H are both $1/2$, and independent of earlier measurements, the probability that a new run begins on a given measurement is also $1/2$.
Then, we (trivially) begin a new run with the first measurement.  The number of additional runs then has a binomial distribution with $14$ trials and $1/2$ probability of success.  Therefore, the probability that there are $r$ runs in the $15$ measurements is equal to
$$
p_r = \binom{14}{r-1} \left(\frac{1}{2}\right)^{14}
$$
For instance, for there to be $r = 5$ runs, as you found in part (a), there is the initial run started by the first measurement, and then there must be $r-1 = 4$ new runs started amongst the $14$ remaining measurements.  This happens with probability
$$
p_4 = \binom{14}{4} \left(\frac{1}{2}\right)^{14}
    = \frac{1001}{16384} \doteq 0.061096
$$
