Ricardo had to start with 16 golf balls.
Explanation
First we will assume that the number of golf balls in starting was [tex] x [/tex]
He lost 6 golf balls while playing yesterday, that means remaining number of the balls [tex] = x-6 [/tex]
Today he bought 12 golf balls , so now the number of balls [tex] = (x-6) +12 = x+6 [/tex]
Then he lost 4 balls on the course today, so the remaining number of balls [tex] = (x+6) -4 = x+2 [/tex]
The question says that he now has 18 golf balls, that means...
[tex] x+2 = 18\\\\ x=18-2\\\\ x= 16 [/tex]
So, Ricardo had to start with 16 golf balls.