What does 頭をひねった mean?


An example is (Tanaka and the speaker are in a relationship.):

> どれだけあたしと田中さんが頭をひねったか  
>  (I think it means something like) How long have Tanaka and I...

頭をひねった doesn't make much sense literally, so I'm not sure about it.




Consider "scratching your head".

I suspect the person who downvoted here may not realize that this expression
has two (semi-related yet distinct) meanings:

  1. An intensive mental process trying to find some answer or solution, with at least the potential that such answer or solution might actually be found. This is the case where one might use the "rack your brain" translation.

  2. Wondering about or being confused or puzzled by something. One reference describes this as 「疑問に思う」, and gives as an example 「高すぎる見積もりの数字に頭をひねる」. There is no notion that your mental activity is going to resolve the confusion; you're just stating that your brain was spinning because you are (or were) confused or surprised or couldn't understand something. This is the case where one is better off with the "head scratching" translation. In the example above: "The high estimate left me scratching my head", or perhaps more colloquially, "The estimate was head-scratchingly high". 

The English word "puzzle" actually works for both, with slight variations:

  1. "how much Tanaka and I puzzled over this"

  2. "how puzzled Tanaka and I were by this"

