hmmm what's the slope of y = x? well, let's notice is already in slope-intercept form, so y = 1x + 0, has a slope of 1.
[tex] \bf \stackrel{\textit{perpendicular lines have \underline{negative reciprocal} slopes}} {\stackrel{slope}{1\implies \cfrac{1}{1}}\qquad \qquad \qquad \stackrel{reciprocal}{\cfrac{1}{1}}\qquad \stackrel{negative~reciprocal}{-\cfrac{1}{1}\implies -1}} [/tex]
so we're really looking for the equatio of a line whose slope is -1, and runs through 4,2.
[tex] \bf (\stackrel{x_1}{4}~,~\stackrel{y_1}{2})~\hspace{10em} slope = m\implies -1 \\\\\\ \stackrel{\textit{point-slope form}}{y- y_1= m(x- x_1)}\implies y-2=-1(x-4) \\\\\\ y-2=-x+4\implies y=-x+6 [/tex]