how does someone go about deriving the aggregate demand function?

what should i explain first