He must be having a hard time reaching your expectations and maybe he keeps on comparing himself to his sister that is why when he failed once he always think he's a great loser already. just show him your love without any expectations and comparison, a kind of love that a parent gives to their child. Avoid nagging and teaching them, he's old enough to know what he is doing. He just needs someone to understand.
There's no easy way to say that to a child, but telling the truth is the most effective way, it may be painful but you have to go through that situation. Anyway, there's always a consequence in everything we do.
It all depends on how you raise your kids. Generally, if you are wicked smart, it doesn't follow that your kids are too, but on some cases they are true because you will raise your kids the way you have been raised by your parents.