I need to know if I did this problem correctly or incorrectly.
Twelve fair coins are flipped.
(a) What is the expected number of heads that will be obtained?
if a coin is tossed 12 times, the maximum probability of getting heads is 12.
(b) What is the variance in the expected number of heads?
E[X]= (1)(1/2)+(2)(1/2)+(3)(1/2)+(4)(1/2)+(5)(1/2)+(6)(1/2)+(7)(1/2)+(8)(1/2)+(9)(1/2)+(10)(1/2)+(11)(1/2)+(12)(1/2) = 39
E[X^2]= (1)^2*(1/2)+(2)^2*(1/2)+(3)^2*(1/2)+(4)^2*(1/2)+(5)^2*(1/2)+(6)^2*(1/2)+(7)^2*(1/2)+(8)^2*(1/2)+(9)^2*(1/2)+(10)^2*(1/2)+(11)^2*(1/2)+(12)^2*(1/2) = 325
Var(X)=(E[X^2]-µ^2)= 325-(39)^2= 325-1521 = -1196
Your attempted answers are incorrect and should be obvious that they are incorrect for a number of reasons. Think about what it is saying. "If I flip 12 coins, I expect around 39 of those coins to be heads" can't be true. Further, variances are never negative numbers.
Hint:
This follows a binomial distribution.
The probability of getting exactly $k$ heads in your experiment is instead $$Pr(X=k)=\binom{12}{k}\left(\frac{1}{2}\right)^k\left(\frac{1}{2}\right)^{12-k}$$
Use this to properly calculate the correct probabilities for $X$ to be equal to $0,1,2,\dots,12$ and fix your calculations for $E[X]$ and later for $E[X^2]$.
Alternate solution hint:
You could approach via indicator variables quite easily by noting that the random variable $X$ which counts the total number of heads is the sum of indicator variables $X_1,X_2,X_3,\dots,X_{12}$ where $X_i$ is a random variable which takes the value of $0$ if the $i$'th coin is a tail and $1$ if the $i$'th coin is a head. From there you can use linearity of expectation for an almost immediate solution.