Environmental Effect on the Associations of Background Quasars with Foreground Objects. I. Analytic Investigation