According to goo辞書 says, きわま・る〔きはまる〕【極まる/窮まる】の意味
- 極{きわ}める/極{きわ}まる : (極める)これより先はないというところまで行き着く。
- 富士山{ふじさん}の頂上{ちょうじょう}を極{きわ}める。
Achieving to the top of Mt.Fuji.
It is used in the supremum/infimum, the ultimate state.
2.(極める・窮める)極点に達した状態になる。この上もない程度までそうなる。
I think 窮める is used most often in negative sentence like this.
According to this site, 極める・究める・窮めるの違いや使い分けとは? - 国語力アップ, they say 窮めるとは物事/状況が行き詰まる事.
- 困難{こんなん}を窮{きわ}める。
- 進退{しんたい}窮{きわ}まる
Getting stuck in the most hardest time/state
On the other hand, in some settings, it is used in affirmative way like No.4.
And, 極める is used in affirmative sentence.
Spending the most luxurious moment.
残{のこ}るところなく尽{つ}くす。
Praise with the great acclaim.
4.(究める・窮める)深く研究して、すっかり明らかにする。
Studying truth of things to the full.
- 終わらせる。
- 決める。定める。
I think I have not used these meaning other than martial arts.
Holding his joints to get submission.
According to this site「谷」はなぜ「たに」と「きわまる」の意味があるのか? : 常用漢字論―白川漢字学説の検証,
谷{きわ}まる is used in the same way as No.2.
- 原文:人亦有言 進退維谷
- 訓読:人亦(また)言有り 進退維(こ)れ谷(きわま)る
- 翻訳:昔の人の言葉あり 「進退ともに窮まる」と――『詩経』大雅・桑柔
窮まって動きが取れない意味で使われている。「穴・くぼみ」というコアイメージがあるから、くぼみにはまって動きが取れなくなるというイメージに転じたのである。進むも退くもできなくなることを「進退谷{しんたいきわま}る」という。
It explains they have an image of a hole, which changed into the getting stuck and would not move.