Objective To study the difference of cognitive function between the elderly with depression and anxiety symptoms in Beijing community and the elderly without depression and anxiety symptoms, and to analyze the incidence of depression and anxiety and its impact on cognitive function. Methods From October 2017 to January 2018, a questionnaire survey was conducted in the elderly aged 60 and above from 6 communities of Beijing using convenience sampling method. The survey included a self-made general data questionnaire, Patient Health Questionnaire-9( PHQ-9), Generalized Anxiety Disorder-7( GAD-7) and Perceived Deficit Questionnaire-5( PDQ-5) to investigate depression, anxiety and cognitive impairment in the elderly. Results A total of 622 patients were recruited. The detection rate of depressive symptoms, anxiety symptoms, depression complicated with anxiety and cognitive impairment was 8.36%( 52/622), 12.54%( 78/622), 5.95% (37/622) and 43.73%( 272/622) respectively. The cognitive impairment in female was more than in male, and the difference was statistically significant( χ2=5.19,P< 0.01). The proportion of cognitive impairment in patients with positive depressive symptoms( 44/52, 84.61%) was higher than that in negative ones( 228/570, 40.00%), and the difference was statistically significant( χ2=38.55, P < 0.01). The proportion of cognitive impairment in patients with positive anxiety symptoms( 67/78, 85.90%) was higher than that in negative ones( 205/544,37.68%), and the difference was statistically significant( χ2=64.44, P< 0.01). The result of Logistic regression analysis showed that the risk factors of cognitive impairment in the elderly were female( OR=1.98, 95%CI=1.21- 3.25, P < 0.01) and anxiety symptoms( OR=27.89, 95%CI=3.54-219.45, P < 0.01). Conclusions PHQ- 9 and GAD-7 can effectively detect depression and anxiety symptoms in the elderly, and PDQ-5 can detect cognitive impairment in the elderly as early as possible. Cognitive impairment was more pronounced in female with anxiety symptoms.