The second-order difference equation, frequently encountered in diffraction of electromagnetic waves by a wedge-shaped region, is studied, and the solution is given for an arbitrarily angled wedge. The solution is suitable for the Sommerfeld-Maliuzhinets representation of the diffracted field. It is shown that the diffracted field from an arbitrarily angled wedge with anisotropic impedance boundary conditions on its faces can be calculated when the electromagnetic plane wave is obliquely incident. The solution can also be used to find the scattered field when the scatterer is penetrable, for example, the hollow dielectric wedge. By this solution, the matrix Riemann problem for analytic vectorial functions is solved, and the solution is presented in closed form.