如图,在正方形ABCD中,点E时CD边上一点,AF⊥AE交CB的延长线于点F,连接DF分别交于AE、AB于点C、P连接PE.
(1)求证:AE=AF;
(2)若AD=2,求当DE为何值时,四边形APED是矩形.