be hitting (one's) head against a (brick) wall
To be attempting, continuously and fruitlessly, to accomplish some task or achieve some goal that is or seems ultimately hopeless. I feel like I've been hitting my head against a brick wall trying to understand this math equation. Calculating it like that is like hitting your head against a wall. Let me show you a shortcut.