# Hypothesis Testing Two Measures Coin Tosses Martingale

Consider a sequence of iid tosses of a coin with $$X_i$$ denoting the outcome of the $$i^{th}$$ toss. These random variables are defined on some $$(\Omega, \mathcal{F})$$ on which we have two probability measures $$\mathbb{P}_{A}$$ and $$\mathbb{P}_{B}$$. Under hypothesis $$A$$, $$\mathbb{P}_{A}$$ is the true measure, and the probability of a head on any toss is $$p=a$$. Under hypothesis $$B$$, the measure is $$\mathbb{P}_{B}$$ and $$p=b$$ for some $$a,b \in (0,1)$$.

Let $$P_{A}(x_1, x_2, \dots, x_n)$$ denote the probability of a sequence of outcomes $$(x_1, x_2,\dots, x_n)$$ under the hypothesis $$A$$, i.e.

$$P_{A}(x_1, x_2, \dots, x_n) = \mathbb{P}_{A}(X_1 = x_1, X_2 = x_2, \dots, X_n = x_n),$$

with the analogous definition for $$P_B$$.

I need to show that $$Z_n = \frac{P_A(X_1, X_2, \dots, X_n)}{P_B(X_1, X_2, \dots, X_n)}$$ is a martingale under $$\mathbb{P}_{B}$$, relative to the filtration generated by the tosses, $$\mathcal{F}_n = \sigma(X_k : k \le n)$$. Then I need to see what happens to the distribution of its limit (which I will know exists almost surely by the Martingale Convergence Property).

I am struggling to prove that $$Z_n$$ is indeed a martingale: it is clear that it is adapted, but I am not sure how to show integrability and the expectation property.

Would it also follow that $$\frac{1}{Z_n}$$ is a $$\mathbb{P}_{A}-$$martingale?

I will only address the martingale part. I will indicate with $$\mathcal{S}$$ our discrete state space. First we check integrability: \begin{aligned}E^{\mathbb{P}_B}[Z_n]&=\sum_{x_1,...,x_n\in \mathcal{S}}\frac{P_A(x_1,...,x_n)}{P_B(x_1,...,x_n)}\mathbb{P}_B(X_1=x_1,...,X_n=x_n)=\\ &=\sum_{x_1,...,x_n\in \mathcal{S}}P_A(x_1,...,x_n)=1,\,\forall n\end{aligned}
since probabilities sum up to one. We have $$P'_A(x_1,...,x_n):=\frac{P_A(x_1,...,x_n)}{P_A(x_1,...,x_{n-1})}=\mathbb{P}_A(X_n=x_n|X_1=x_1,...,X_{n-1}=x_{n-1})$$ and equivalently for $$P_B$$. So \begin{aligned}E^{\mathbb{P}_B}[Z_{n}Z_{n-1}^{-1}|\mathscr{F}_{n-1}]&=E^{\mathbb{P}_B}\bigg[\frac{P_A(X_1,...,X_n)}{P_B(X_1,...,X_n)}\frac{P_B(X_1,...,X_{n-1})}{P_A(X_1,...,X_{n-1})}\bigg|\mathscr{F}_{n-1}\bigg]=\\ &=E^{\mathbb{P}_B}\bigg[\frac{P_A'(X_1,...,X_{n})}{P_B'(X_1,...,X_{n})}\bigg|\mathscr{F}_{n-1}\bigg]\end{aligned} and \begin{aligned}&E^{\mathbb{P}_B}\bigg[\frac{P_A'(X_1,...,X_{n})}{P_B'(X_1,...,X_{n})}\bigg|X_1=x_1,...,X_{n-1}=x_{n-1}\bigg]=\\ &=\sum_{x_n \in \mathcal{S}}\frac{P_A'(x_1,...,x_{n-1},x_n)}{P_B'(x_1,...,x_{n-1},x_n)}\mathbb{P}_B(X_n=x_n|X_1=x_1,...,X_{n-1}=x_{n-1})=\\ &=\sum_{x_n \in \mathcal{S}}P_A'(x_1,...,x_{n-1},x_n)=1\end{aligned} since again probabilities sum up to one. So we conclude.