Assume that USco carries on an active business in the United States (other than an investment business). USco owns all of the shares of Canco, a corporation resident in Canada, which carries on an active business in Canada that is parallel to USco's active business. The active business carried on by USco in the United States is substantial in relation to the active business carried on by Canco.
1) Canco distributes a portion of its after-tax income from its active business to USco in the form of dividends on its shares
Since USco and Canco carry on parallel business activities and the dividends are paid out of the after-tax earnings from Canco's business, we would consider the dividends received by USco to be derived in connection with USco's active business.
2) USco sells the shares of Canco and realizes a taxable capital gain
Since the value of the Canco shares (and thus the taxable capital gain) is derived from an active business in Canada that is parallel to the active business carried on by USco in the United States, we would consider the taxable capital gain on the disposition of the shares of Canco to be derived in connection with USco's active business.