Which is correct | rack brain
TheOxfordDictionaryOnline[1]saysthatthephrasecoulduseeitherwrackorrack.TheynotethatTherelationshipbetweentheformsrackandwrackiscomplicated.Themostcommonnounsenseofrack,‘aframeworkforholdingandstoringthings’,isalwaysspelledrack,neverwrack.Inthephraseracksomethingupthewordisalsoalwaysspelledrack.Figurativesensesoftheverb,derivingfromthetypeoftortureinwhichsomeoneisstretchedonarack,can,however,bespelledeitherrackorwrack:thusrackedwithguilt;orwrackedwithguilt;rackyourbrains;orwrackyourbrains.How...
The Oxford Dictionary Online[1] says that the phrase could use either wrack or rack. They note that
The relationship between the forms rack and wrack is complicated. The most common noun sense of rack, ‘a framework for holding and storing things’, is always spelled rack, never wrack. In the phrase rack something up the word is also always spelled rack. Figurative senses of the verb, deriving from the type of torture in which someone is stretched on a rack, can, however , be spelled either rack or wrack: thus racked with guilt; or wracked with guilt; rack your brains; or wrack your brains.
However, according to this entry for wrack in EtymOnline[2], the term should be rack:
The verb meaning "to ruin or wreck" (originally of ships) is recorded from 1560s, from earlier intrans. sense "to be shipwrecked" (late 15c.). Often confused in this sense since 16c. with rack (1) in the verb sense of "to torture on the rack;" to wrack ones brains is thus erroneous...