How to check if the user was redirected?

You can use wp_get_referer function to acheive your requirement.

Below is the useful code snippet for you.

    function wdm_referer()
    {
        global $post;

        if( post type is child  ) {

            $child_post_id = $post->ID;

            $parent_id = get_parent_course_id($child_post_id); // your custom function to get parent course id

            if( parent task is not completed ) { // a condition that you are checking on child page and redirecting

                // to get http referer
                $page_referer = wp_get_referer();

                // to get parent post permalink
                $parent_permalink = get_permalink( $parent_id );

                // if parent course link is same as http referer
                if( $page_referer == $parent_permalink ) {
                    //user came from parent course. Your code to display in content
                }
            }
        }
    }

add_action('the_content', 'wdm_referer');