a^2+b^2-4a+2b+5
=(a^2-4a+4)+(b^2+2b+1)
=(a-2)^2+(b+1)^2=0
因为(a-2)^2≥0,(b+1)^2≥0
所以(a-2)^2=(b+1)^2=0
即a-2=b+1=0
则a=2,b=-1