Theory of FBG