# Why are boundary terms eliminated in the Galerkin method?

I'm trying to learn the Galerkin method for finite element. I found this useful document with a 1D example about the stretching of a bar (pages 26 - 46).

This is the differential equation, boundary conditions, and the function that I'm trying to use to approximate it.

When computing the weak form you get some 'boundary terms' from the integration by parts. And I have seen in a lot of example that they get eliminated. WHY? In this case it might be because of the boundary conditions, both terms are zero. But if that's the case I can easily change the BCs and take them into account. But if I do that then I cannot solve the system, is it because if trial function I'm using?

Can someone clarify, why are this terms eliminated, and if the trial function that I'm using is ok?