4.17

कर्मणो ह्यपि बोद्धव्यं बोद्धव्यं च विकर्मणः ।
अकर्मणश्च बोद्धव्यं गहना कर्मणो गतिः ॥

karmaṇo hy api boddhavyaṃ boddhavyaṃ ca vikarmaṇaḥ
akarmaṇaś ca boddhavyaṃ gahanā karmaṇo gatiḥ

Kṛṣṇa (कृष्ण) is still speaking, to Arjuna.

The verse

Action must be understood, and wrong action, and inaction; the course of action is dense.

नेपालीमा

कर्म बुझ्नुपर्छ, गलत कर्म पनि, र अकर्म पनि। कर्मको चाल गहन छ।

Where it sits

4.16 asked about action and inaction, and this verse adds a third, action that goes aside, because the course itself is hard to see through. 4.18 is the seeing that answers that density.

Split: कर्मणः + हि + अपि + बोद्धव्यम् + बोद्धव्यम् + च + विकर्मणः + अकर्मणः + च + बोद्धव्यम् + गहना + कर्मणः + गतिः

karmaṇaḥ + hi + api + boddhavyam + boddhavyam + ca + vikarmaṇaḥ + akarmaṇaḥ + ca + boddhavyam + gahanā + karmaṇaḥ + gatiḥ

Sanskrit, in depth

The words

देवनागरीWordGrammarSense
कर्मणःkarmaṇaḥgenitiveof action.
हिhiindeclinableindeed.
अपिapiindeclinablealso, even.
बोद्धव्यम्boddhavyamgerundive, nominative neuterto be understood. It must be known. From budh (बुध्).
बोद्धव्यम्boddhavyamgerundive, nominative neuterto be understood.
चcaindeclinableand.
विकर्मणःvikarmaṇaḥgenitiveof action that goes aside, action wrongly done. vi- (वि-) turns the act off its line.
अकर्मणःakarmaṇaḥgenitiveof inaction.
चcaindeclinableand.
बोद्धव्यम्boddhavyamgerundive, nominative neuterto be understood. The third time.
गहनाgahanānominative femininedense, hard to get through.
कर्मणःkarmaṇaḥgenitiveof action.
गतिःgatiḥnominativethe course, the way it goes.

The phrases

karmaṇaḥ hi api boddhavyam (कर्मणः हि अपि बोद्धव्यम्) is the first duty of understanding. Action, too, must be understood. karmaṇaḥ hi (कर्मणः हि) is karmaṇo hi (कर्मणो हि). hi api (हि अपि) is hy api (ह्यपि).

boddhavyaṃ ca vikarmaṇaḥ (बोद्धव्यं च विकर्मणः) is the second. And wrong action must be understood. The gerundive is the same word, used again so the three genitives stay parallel.

akarmaṇaḥ ca boddhavyam (अकर्मणः च बोद्धव्यम्) is the third. And inaction must be understood. akarmaṇaḥ ca (अकर्मणः च) is akarmaṇaś ca (अकर्मणश्च): aḥ (अः) before the voiceless c (च्) becomes aś (अश्).

gahanā karmaṇaḥ gatiḥ (गहना कर्मणः गतिः) is why the three have to be learned one by one. The course of action is dense. karmaṇaḥ gatiḥ (कर्मणः गतिः) is karmaṇo gatiḥ (कर्मणो गतिः).

Sanskrit in this line

boddhavyam (बोद्धव्यम्) is a gerundive used impersonally. Neuter, with no person on it: "it is to be understood," not "you must" as a verb ending. The three genitives, karmaṇaḥ (कर्मणः), vikarmaṇaḥ (विकर्मणः), and akarmaṇaḥ (अकर्मणः), say what has to be understood. The ending --tavya (तव्य) is the "to be done" of this verse.

Say it back

The three that must be understood, in order. If vikarmaṇaḥ (विकर्मणः) is skipped, or folded into karma (कर्म), stay here.