Here's the solution provided:

I don't understand how they got that answer! This is my own attempt:

Since is a piece-wise function I divided the interval to two and calculated the inner product like this:

So, why is my method and my answer wrong? And could anyone please explain the method used in the model answers?