设直线方程为y=k(x-2)+1,设A(x1,y1),B(x2,y2),因为P平分AB,所以P是AB中点,所以x1+x2=4,y1+y2=2,因为A,B在椭圆上,所以(x1)^2/16+(y1)^2/4=1,(x2)^2/16+(y2)^2/4=1,
所以(x1-x2)(x1+x2)/16+(y1-y2)(y1+y2)/4=0,所以4(x1-x2)/16+2(y1-y2)/4=0,所以k=(y1-y2)/(x1-x2)=-1,所以直线方程为y=3-x,即x+y=3
设直线方程为y=k(x-2)+1,设A(x1,y1),B(x2,y2),因为P平分AB,所以P是AB中点,所以x1+x2=4,y1+y2=2,因为A,B在椭圆上,所以(x1)^2/16+(y1)^2/4=1,(x2)^2/16+(y2)^2/4=1,
所以(x1-x2)(x1+x2)/16+(y1-y2)(y1+y2)/4=0,所以4(x1-x2)/16+2(y1-y2)/4=0,所以k=(y1-y2)/(x1-x2)=-1,所以直线方程为y=3-x,即x+y=3