I was working on some problem and managed to solve using one approach but when I tried a different approach to the same problem I didn't get the expected result, when I was going to ask on the math stack exchange about this problem I saw that this problem was already posted there and solved with a different take. So I want to know if it's okay to post the problem again but asking the reason why my second attempt didn't worked and if I could change something in it to get the same result.
From my understanding, your question is "where did I go wrong?" The other question asks "how to solve this?" Since these two are conceptually different, it is ok to ask your question here. It would also be a good idea to link to the other question as well and explain the difference.
As far as I understand, asking the exact same problem is likely not a good idea. A better approach is to edit in any new details that you discovered in the original question, especially if the original has been closed, which can also help it gather re-open votes (assuming you want it reopened).
On the other hand, if the problem contains a special case that isn't already covered by the original problem addressing a general case, then I believe it is okay to ask the question again as long as you specify the reason for doing this. In fact I have just done this an hour ago.