A very good section of the play to examine in response to this is Act II scene 2, and also Act I scene 2. In Act II scene 2, Gertrude herself offers up her suggestion of why Hamlet is in such a "distemper," as Claudius calls it. Note what she says:
I doubt it is no other but the main--
His father's death and our o-er-hastly marriage.
Gertrude therefore clearly feels that it is her marriage to Hamlet's uncle that is in part the cause of his bad mood and sullen nature. In addition, if we look at Hamlet's first soliloquy in Act I scene 2, which comes just after Claudius has tried to encourage Hamlet to stop wearing mourning clothes, Hamlet clearly identifies what his problem is:
A little month, or ere those shoes were old
With which she followed my poor father's body,
Like Niobe, all tears, why she, even she--
O God, a beast that wants discourse of reason
Would have mourned longer!--married with mine uncle...
Hamlet directly answers the question: it is the speed with which his mother forgets the apparent devotion of her love for his father and then her act in marrying his uncle that has put him into a state of such "distemper." This is the root cause of the problem for Hamlet, and it makes him doubt the affection that his mother had for his father, which in turn makes him doubt his mother.