Let's consider null hypothesis that we want to examine, that probability of success is smaller than $\frac 1 2$ in Bernouli distribution. We also have independent sample of $20$ observations: $x_1, x_2, ..., x_{20}$ from this distribution. We are going to reject the null hypothesis if any only if amount of observed successes in this experiment is 11 or lower. I want to calculate power of this test:
My work so far
$$X \sim \text{Bernouli}(\theta)$$ $$H_0:\theta < \frac 1 2$$
Function $\phi$ is a function that takes value $1$ when we reject null hypothesis and value $0$ when we do not reject it. In our example:
$$\phi(x_1, x_2, ..., x_{20}) = \begin{cases} 1& \text{with probability} \;{20 \choose 11} \theta^{11} (1 - \theta)^{9}\\ 0& \text{with probability} \;1 - {20 \choose 11} \theta^{11} (1 - \theta)^{9} \end{cases}$$
Then power of the test is given as $E_\theta[\phi(x_1,...,x_{20})] = {20 \choose 11} \theta^{11} (1 - \theta)^{9} $
Am I correct with my calculations?
Comment: As @Henry comments, something must be wrong with the statement of your question. Maybe I can help you formulate a more reasonable version of it.
If you are testing $H_0: p = 1/2$ against $H_a: p < 1/2,$ then it might make sense to reject $H_0$ if you see $x \le 6$ Successes in $n = 20$ trials. Then the significance level of your test would be about 6%. [Because of the discreteness of the binomial distribution, it is not possible to have a (nonrandomized) test at exactly the 5% level.] Computation using R:
In order to find the power of my proposed test with critical value $c = 6,$ you would have to specify a particular alternative success probability $p_a.$
Perhaps you want to find the probability of rejecting $H_0$ with my test if the true success probability is $p_a = 1/4.$ Then you need to find $P(X \le 6 \,|\, p=1/4) = 0.7858,$ which is the power of my test against the alternative $p_a = 1/4.$
Taking another approach, let's look at the exact binomial test procedure
binom.testin R: With $x = 11$ successes is $n=20$ trials, that test gives P-value $0.7483.$ To test (nearly) at the 5% level, you would want to see a P-value near $0.05 = 5\%.$The bottom line is that it would make no sense to reject $H_0: p=1/2$ in favor of $H_a: p < 1/2,$ when the estimated success probability is $\hat p = x/p = 0.55 > 1/2.$
Notes:
(1) Power curve. It is possible to make a 'power curve', showing powers of my test proposed above for various alternative values of $p_a.$ Red lines show the power for the particular alternative $p_a = 1/4,$ discussed above.
(2) Another reasonable scenario and test. If $n = 33,$ then it makes sense to use $c=11$ as the critical value for a left-sided test at the 4% level, which would have power about 90% against the alternative value $p_a = 1/4.$ [I will let you fill in the gaps on this proposed test, based on the following computations in R.]