Sum-of-Product understanding
I dont get is the second picture where from x1,x2,and x3, they get the f(x1,x2,x3).


In the second table, the given f(x1, x2, x3) is part of the problem statement. 

For any f(x1, x2, x3) function you are given, you can find a SOP representation, and from there design the logic to implement the function.

The one in the table is just an example to illustrate this procedure.