Hi. I did this quick so check me ok:
Then I get:
when I put all that into the cost function as a function of w I get:
Next thing I would do is outright plot it and see if it has a minimum. If the plot doesn't, then I made a mistake and no need to go further. I'll leave that for you to check. If it does, then find the extrema to find the minimum cost.