You can
put this solution on YOUR website!
P(R or W) = P(R) + P(W) - P(R and W)
The hat can't be both red and white because
P(R) + P(G) + P(W) = 1/4 + 1/4 + 1/2 = 1, so P(R and W) = 0
P(R or W) = P(R) + P(W) - P(R and W) = 1/4 + 1/2 - 0 = 1/4 + 2/4 = 3/4
Or we could have just done it this way:
P(R or W) = P(not G) = 1 - 1/4 = 4/4 - 1/4 = 3/4
Edwin