Number of ways of selecting unordered pair of sets $A$ and set $B$ such that $A\cup B\subset X$ $X={1,2,3,....,2017} $ and $A\subset X; B\subset X; A\cup B\subset X$ Then number of ways of selecting unordered pair of sets $A$ and set $B$ such that $A\cup B\subset X$ will be?
Answer is $\frac{4^{2017}-3^{2017}+2^{2017}-1}{2}$
I think each element of $X$ has $3$ options i.e. go to $A$ or go to $B$ or don't go to any of them. Although can't make much after that. How should I proceed?
 A: I don't think the given answer is correct.  If $X$ has just one element, the formula would say there are $\frac {4-3+2-1}2=1$ ways, but $A$ and $B$ can both have the element, neither can have the element, or one of them can have the element for three.  If $X$ has two elements, the formula would say there are $\frac {4^2-3^2+2^2-1^2}2=5$ choices, but $A$ can have both and there are $4$ choices for $B$, or $A$ can have the first and $B$ can have either one or be empty, or $A$ can have the second and $B$ can have the second or be empty, or both can be empty for $10$ choices.  
Each element has four possibilities:  it can be in both $A$ and $B$, just $A$, just $B$, or neither. We therefore have $4^{2017}$ ways of choosing $A$ and $B$ if we consider order.  To get the unordered ways, we divide by $2$ for all the cases where $A \neq B$, but do not divide by $2$ when $A=B$.  To make $A=B$ each element has two choices:  both or neither.  So there are $4^{2017}-2^{2017}$ ordered ways to choose distinct $A,B$ and $\frac 12(4^{2017}-2^{2017})$ unordered ways with distinct $A,B$.  Add to this the $2^{2017}$ ways with $A=B$ and we get $\frac 12(4^{2017}+2^{2017})$  This matches my hand calculations for $|X|=1,2$
