I don't have any way to see if I have done this in a correct way(no answers in my book). Did I do it right?
Question: "How many eight-bit strings either begin 100 or have the fourth bit 1 or both?"
My calculations: X - contains the strings that begins with 100 Y - contains the strings that has the fourth position set to 1
As I understand the question, this is how the bit string looks like: $[?????100]$. If it begins with 100.
The size of $|X|$:
Since we already have 3 bits already set, 100, that means we only have 5 bits that can change in value which gives us 32 combinations.
$|X| = 32$
The size of $|Y|$: Now we have 6 bits to work with. $2^7=128$
$|Y| = 128$
Combined $|X|∩|Y|$:Half of all bit strings contain the 1 bit on the fourth position. Which must mean half of the bit strings in X contain 1 on position 4. So I remove them, to not get repititon, now $|X|$ = 16
So $|X|U|Y|$ = 144
There are 144 bit string that either starts with 100 or has bit 1 on the fourth position.
Am I correct?
As confirmation, and to demonstrate a useful technique:
You are trying to count strings that meet a complex set of requirements. Instead, look at the complementary problem; in this case: How many strings fail the requirements?
There are $256$ eight-bit strings.
There are eight possible leading three-bit strings; seven of them (all but $100$) fail being the required leading string, and are candidates for elimination from the counted group. Considering these candidates, half of them will have the fourth bit $0$ and, having failed both qualifications, will not be part of the group to be counted:
So the number not counted:$$N_{not}=256 \times \frac78 \times \frac12=112$$So the number counted : $$N_{Count}=256-112=144$$