We can try to brute force the answer as follows: use
¬ for not,
∧ for and,
∨ for or and
⊕ for xor. Since the function only gives 1 for (x1, x2, x3) = (0, 0, 1), (0, 1, 0), (1, 0, 0), (1, 0, 1), (1, 1, 1), the function is:
f(x)=(¬x1∧¬x2∧x3)∨(¬x1∧x2∧¬x3)∨(x1∧¬x2∧¬x3)∨(x1∧¬x2∧x3)∨(x1∧x2∧x3)
I hope you see what I was doing there: Each pair of parentheses corresponds to one case where f(x) would give 1. We then simplify the function so it isn't that long:
f(x)==(¬x1∧¬x2∧x3)∨(¬x1∧x2∧¬x3)∨(x1∧¬x2∧¬x3)∨(x1∧¬x2∧x3)∨(x1∧x2∧x3)(¬x1∧¬x2∧x3)∨(¬x1∧x2∧¬x3)∨(x1∧¬x2∧¬x3)∨(x1∧x3)
To convert this to a form with (1, AND, XOR), simply note that the first three terms is equivalent to
(x1∧x2∧x3)⊕x1⊕x2⊕x3. (You can verify it using a truth table, or find it because
x1⊕x2⊕x3 will give 1 when the number of 1 among
x1,x2,x3 is odd-numbered, then you exclude the case that all of them are 1 by taking the xor of the result of the previous step with
x1∧x2∧x3).
So
f(x)=((x1∧x2∧x3)⊕x1⊕x2⊕x3)∨(x1∧x3)
But note that the when first operand of the
∨ gives 1, the second must give 0 and vice versa. Because of this, we can replace
∨ by
⊕ without changing the value of the expression.
f(x)=(x1∧x2∧x3)⊕x1⊕x2⊕x3⊕(x1∧x3)