Tryring to execute a command but i keep seeing the Msg 8120 error

i need to display the average GPA of both Male nd Female students but after writing the statement i keep getting an error message

This is the select statement

Select AVG(GPA) AS "AVG(GPAM)",
Gender
From Students = 'M'

Select AVG(GPA) AS "AVG(GPAF),
Gender
From Students
Where Gender = 'F'

but then i keep getting this error message

Msg 8120, Level 16, State 1, Line 1
Column 'Students.Gender' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.

Select AVG(GPA) AS "AVG(GPAM)", 
    Gender 
From Students
Group By Gender

i figured that part out but i think i need the Join function to display both Female and Male together

Select  
     AVG(CASE WHEN Gender = 'M' THEN GPA END) AS [AVG(GPAM)] 
     AVG(CASE WHEN Gender = 'F' THEN GPA END) AS [AVG(GPAF)] 
From Students