@lonestudent Elementary question, so care to be taken. Let's talk to OP : source and level of OP is enough. If no information comes out, then we'll close it.
@lonestudent It should be deleted , in particular because the answer , despite of the good score , is not the obvious way to solve this. The obvious way would be to notice that the difference of two squares must be $1$, which is only possible for the pair $(0,1)$
@epsilon-emperor Good point : as far as I see, I prefer to be in the comments, and kind of balancing improving the post and answering the question simultaneously. It's not easy because you won't always succeed, so I've learnt to have a big smile on my face when it works and push the good news around. I also want to say this : it's actually ok with me if an answer develops in the comments (not : not answered , but develops) in the sense...
... that I give a hint, the user proceeds, then I give another hint and/or ask the user to edit their attempt into the question , which makes it a good question, then I can have someone else answer it. Lastly, unless the post is very long and clumped together (basically, visually unappealing), MathJax can be forgiven, either edited in and/or suggested in the comments.
@epsilon-emperor Others have already commented, but some further thoughts:
It is possible to "be nice" without giving an answer. Indeed, I think that it is far "nicer" to use the comments to help the asker improve their question.
By engaging in the comments and helping to make the question better, it is more likely that the question will avoid being closed and deleted. As closure and deletion are often seen as "mean" (NB: I don't think that they necessarily are), and as closure and deletion can lead to question blocks, it is far "nicer" to engage in the comments than it is to leave a one-and-done answer.
@XanderHenderson It's about the choice of word, Xander. Perhaps close means closure from more than just the point of view of accepting answers, it sounds like a death knell. We can't do anything about it, but I'd have preferred something like : "Needs improvement" over a word like : close. Anyway, the actions are still the same , so probably the ire would still be the same.
@StubbornAtom dupes are not word-for-word dupes... But when the answer(s ) given could be copy and pasted into the closed question, with minor edits for specifics used, it's a duplicate. E.g., A question of the form: How to factor $ax^2 + b(x) +c$, where a, b c and be any numbers, the questions are duplicates.
@StubbornAtom Delete vote? Of course. The question is a problem-statement question: an exercise copied from the internet, or a text book, with no context provided by the asker. It should not have been answered, until the question was improved.
@StubbornAtom It is not a duplicate, as pointed out : and in fact, as a mathematical question alone it's really useful because I can think of a superb not-too-mathematical explanation. But : it's a PSQ. The moment generating part hasn't been explained one bit apart from a final expression. I have voted to delete.