Construct a sequence of i.i.d random variables with a given a distribution function I am being asked to solve the following problem:

Assume you have a sequence of i.i.d. (independent identically distributed) random variables, $X_1, X_2, \dots,$ on a probability space $(\Omega,\mathcal{F},P)$ with $P(X_n=1)=P(X_n=-1)=1/2$. Given a distribution function, $F$, use the $X_n$'s to construct a sequence of i.i.d. random variables, $Y_1, Y_2, \dots,$ with distribution function $F$. [Hint: First show that $U=\sum_{n=1}^{\infty} 2^{-n}X_n$ is a Uniform$([0,1])$ random variable, then use $U$ to find one random variable with distribution function F.]

If it helps this was the part (b) of the problem. Prior to this, in part (a) we were asked to solve:

Let $U$ be a Uniform($[0,1]$) random variable (i.e., the distribution of $U$ is the Lebesgue measure on $[0,1]$). Define $X_n=\lfloor 2^n U \rfloor, \ n= 1,2,\dots,$ to be the $n^{\text{th}}$ digit in the binary expansion of $U$
  ($\lfloor x \rfloor$ is the greatest integer less than or equal to $x$). Show that $X_1, X_2, \dots $ are i.i.d. random variables.  Note i.i.d. stands for independent identically distributed.

So in any help you provide feel free to use this result, without proof.
I am really lost, I don't know how to proceed.
I would appreciate any help.
Thanks!
 A: I believe you are being asked to use the 'inverse CDF' or 'quantile'
method of generating random variables. I will show you how it works
and let you fill in the technical details for a proof.
Suppose we have $U \sim Unif(0, 1)$. In applied simulation, this
is the normal starting point because pseudorandom number generators
(PRNGs) typically supply such standard (continuous) uniform values
in sequences that behave as if they are independent for practical
purposes.
Also suppose we want to generate a random sample from an exponential population with rate 1 (hence also mean 1). If $X \sim Exp(1),$ then
the CDF of $X$ is $F(x) = 1 - e^{-x},$ for $x > 0.$ The quantile function
$F^{-1}(u)$ is $F^{-1}(u) = -\log(1 - u),$ were we use logs base $e$.
Thus if $U \sim Unif(0,1)$, then one can show that 
$F^{-1}(U) = X \sim Exp(1).$
Below is a demonstration using R statistical software: Notice that
simulated samples of size $m = 100,000$ have very nearly the
theoretical means and standard deviations.
 m = 10^5;  u = runif(m, 0, 1);  x = -log(1-u)
 mean(u);  sd(u);  sqrt(1/12)
 ## 0.4989191  # approx E(U) = 1/2
 ## 0.2887617  # approx SD(U) = sqrt(1/12)
 ## 0.2886751
 mean(x);  sd(x)
 ## 0.9974556  # approx E(X) = 1
 ## 1.001592   # approx SD(X) = 1

Simulated points in a histogram bar for $U$ are transformed
into points in a bar of the same color in the histogram for $X$. Each histogram shows  100,000 simulated values; density functions are shown in blue.
Empirical cumulative distribution functions each show 2000 points.
Theoretical CDFs are shown in light blue. 
In the panel at
lower right, imagine a randomly chosen point $u$ along the vertical axis, move horizontally to the CDF, then vertically down to to
the corresponding $x$. For example, an observation at $u = 0.8$
gets transformed to $x \approx 1.61.$

