# Derive a sufficient statistic for $\theta$.

Exercise: Suppose that $X = X_1,\ldots,X_n$ are i.i.d. random variables with the $\operatorname{Ber}(\theta)$ distribution. Derive a sufficient statistic for $\theta$.

What I've tried: I know that by the Factorisation theorem $T(X)$ is a sufficient statistic if the likelihood function of $X$ can be written as $$f_X(X\mid\theta) = g_\theta(T(X))h(X)$$ where $h$ and $g_\theta$ are nonnegative Borel functions. So I've chosen to rewrite the likelihood function in the form of the factorisation theorem: $$f_X(X\mid\theta) = \prod_{i = 1}^n\theta^{x_i}(1-\theta)^{1-x_i} = \theta^{\sum_{i =1}^nx_i}(1-\theta)^{\sum_{i = 1}^n(1-x_i)}$$ However, I don't know how to proceed from here, as I can't see how this would been rewritten to the form used in the factorisation theorem.

Question: How do I solve this exercise? (Preferably with the factorisation theorem)

Thanks!

Let us consider $T(X) = \sum_{i=1}^n X_i$. We have $$f_X(x|\theta) = \prod_{i=1}^n \theta^{x_i} (1-\theta)^{1-x_i} = \theta^{T(x)} (1-\theta)^{n-T(x)} .$$ This can be written $$f_X(x|\theta) = g_\theta(T(x))\, h(x) \, ,$$ where $g_\theta:T\mapsto \theta^{T} (1-\theta)^{n-T}$ and $h(x) = 1$, which demonstrates that $\sum_{i=1}^n X_i$ is a sufficient statistic for the parameter $\theta$ of the Bernoulli distribution.