Recessed lighting should be placed 18 inches away from the wall and you should space the recessed lighting between 3 to 4 feet apart for an 8 foot tall ceiling and for a 10 foot high ceiling the recessed lighting should be spaced at least 5 feet apart.
At both ceiling heights you should space the recessed lightning 18 inches from each wall.