Special rules for first and last year of residency
(A) First year of residency (i) In general If an alien individual is a resident of the United States under paragraph (1)(A) with respect to any calendar year, but was not a resident of the United States at any time during the preceding calendar year, such alien individual shall be treated as a resident of the United States only for the portion of such calendar year which begins on the residency starting date. (ii) Residency starting date for individuals lawfully admitted for permanent residence In the case of an individual who is a lawfully permanent resident of the United States at any time during the calendar year, but does not meet the substantial presence test of paragraph (3), the residency starting date shall be the first day in such calendar year on which he was present in the United States while a lawful permanent resident of the United States. (iii) Residency starting date for individuals meeting substantial presence test In the case of an individual who meets the substantial presence test of paragraph (3) with respect to any calendar year, the residency starting date shall be the first day during such calendar year on which the individual is present in the United States. (iv) Residency starting date for individuals making first year election In the case of an individual who makes the election provided by paragraph (4) with respect to any calendar year, the residency starting date shall be the 1st day during such calendar year on which the individual is treated as a resident of the United States under that paragraph.
(B) Last year of residency An alien individual shall not be treated as a resident of the United States during a portion of any calendar year if— (i) such portion is after the last day in such calendar year on which the individual was present in the United States (or, in the case of an individual described in paragraph (1)(A)(i), the last day on which he was so described), (ii) during such portion the individual has a closer connection to a foreign country than to the United States, and (iii) the individual is not a resident of the United States at any time during the next calendar year.
(C) Certain nominal presence disregarded (i) In general For purposes of subparagraphs (A)(iii) and (B), an individual shall not be treated as present in the United States during any period for which the individual establishes that he has a closer connection to a foreign country than to the United States. (ii) Not more than 10 days disregarded Clause (i) shall not apply to more than 10 days on which the individual is present in the United States.