How to know from variables tu use them in a custom code
May be I'm missing something: I don't understand why you want to programatically make the field required.

Required is not a feature of a field by itself, it is an option you can set on its instance once it's attached to a node, through the admin/structure/types/manage/yourContentType/fields/yourFieldName.