Should students who copy homework answers from somewhere else state how they obtained the answer? I'm an 3rd year undergraduate student, and this semester, I'm taking graduate course in one of my departments.

We have homeworks each week, and while doing the problems on those, I sometimes get stuck. In that case, sometimes I go to the instructor for some hints and discussions, and sometimes, if I really haven't made any progress in that question for long time, I search the answer onthe web (for example math.SE), and write that answer if it satisfies me.

In those latter cases, I put some notes/a disclaimer on the top of the question stating that "I've done these and these, but couldn't solve it, so I looked at the answer from the xxx website".

However, is this something that we indeed expected to do, or am I just making myself sometimes look like "incapable of solving even an elementary question" in the eyes of my instructor ?

Edit:
My question is about the general norm in academia, not whether it is considered cheating or not.
It is good to be honest in all that you do. You should, of course, ask your professor whether your "researches" are proper or not. I would treat asking someone on math.se for a solution to your exercise as improper, for example. 

The reason for that is that you don't learn the necessary lessons by reading a solution that you do by creating it. So it is mostly an educational issue, not an ethical one. But your instructor will give you the most useful advice. 

The professor hasn't asked you to solve a problem because he/she needs the solution. The question has been asked because solving the question will advance your  education and finding a solution will be much less effective at that. 

Education is about changing how your brain works. In mathematics, especially, you need to do your own work in order to cause the brain to reorganize itself to make advancement possible. 

Asking the instructor for help is better in this regard than asking someone else, say on math.SE. The reason is that the instructor can give you a hint that will help you advance, rather than a solution that won't. It may even be useful for  your instructor to know that you are struggling with some ideas. You may get advice that gets you past the block. Math.SE is very unlikely to do that. The answers you likely get there will be too helpful. 

Becoming a mathematician is about changes in your brain, not about proofs printed on paper.