I know the Neumann B.C. is implicit in FEM language. However, I have seen at least two ways to impose Dirichlet B.C.

e.g. for the poisson problem in 1D,

$$\nabla^2 u = 0, u_{left}= 1, u_{right}=0$$

1) set first and last *row* of assembled "A" to "0" at left hand side, set A(1,1)=1,A(end,end)=1, and specify the boundary value "1" and "0" in right hand side vector "b".

2) set first *row&column*, last *row&column* of assembled "A" to "0" at left hand side, then do the same thing as above.

these two different ways are different, the first is more intuitive(probably preferred by finite difference user), while the second sounds more rigorous because we are setting the boundary "element".

I know these two ways may result in different for some specific case. Could any body give some insight?