# Bayes factor for fair and biased coin

There is the following task: Suppose we toss a coin $N = 10$ times and observe $m = 9$ heads. Let the null hypothesis be that the coin is fair,and the alternative be that the coin can have any bias, so $p() = U(0; 1)$. Derive the Bayes factor $BF_{1;0}$ in favor of the biased coin hypothesis. What if $N = 100$ and $m = 90$?

What I did so far:

Prior likelihood if coin is biased or unbiased is $0.5$ For the unbiased coin I used binomial distribution:

$p^m (1-p)^{(N-m)}$ = $(0.5)^{10}$

But how to count for the biased coin? With what probabilities should I count?

This is how I understand it and would apply it to your problem: if $H_0$ is the unbiased coin hypothesis then $P(N=10\ m=9\ | H_0) = \binom{10}{9}\frac{1}{2}^{9}\frac{1}{2}^{10-9}$
If $H_1$ is the hypothesis that the coin has a bias $p \in [0,1]$ and that $p$ can have any value in $[0,1]$ with uniform probability ($U(0;1)$) then $P(N=10\ m=9\ | H_1) = \int_0^1 \binom{10}{9} p^9(1-p)^{10-9}dp$
Note: by integration by parts $\int_0^1 p^a(1-p)^{b}dp = \frac{b}{a+1}\int_0^1 p^{a+1}(1-p)^{b-1}dp = ... = \frac{b!}{(a+1)...(a+b)}\int_0^1p^{a+b}dp = \frac{1}{(a+b+1)\binom{a+b}{b}}$