He probably learned it from his father, now I don't know how you can know if you can use it or not, but after reading about it on the wiki(just now), I would say if you can use all 7 gates formation the eighth gate comes automatically, you just have to do it then,
I say that because Lee said he could only use 6 gates when he is currently 17, and could open as far as 5 gates when he was 13, so I guess 7th gate is like the final achievement and the eighth one is just the last price(?) or something,point being only one step further in that many years seems a bit too low, masasha kept him there for a reason, most likely for the reason I stated, but that's just my opinion.
Edit: and what Touken said