Straightforward yet powerful—lines represent the simplest form of linear relationships. They’re the geometric starting point for understanding equations, slopes, and intersections in \(\mathbb{R}^2\) and beyond. 📈
Linear Equations
A linear equation in the variables \(x_1, x_2, \ldots, x_n\) is an equation that can be written in the form:
\[
a_1x_1 + a_2x_2 + \cdots + a_nx_n = b
\]
\(b \in \mathbb{R}\) is a constant, \(a_1, a_2, \ldots, a_n \in \mathbb{R}\) are coefficients typically known in advance, and \(n\) is a positive integer indicating the number of variables.
viewof a = Inputs.range([-10,10], {step:1,value:2,label:tex`a_1`,width:200})viewof b = Inputs.range([-10,10], {step:1,value:3,label:tex`a_2`,width:200})viewof c = Inputs.range([-20,20], {step:1,value:6,label:tex`b`,width:200})// Display the equation using html and tex literalshtml`<div style="text-align: center; font-size: 1.2em; margin: 1em 0;">${tex`${a}x_1 ${b >=0?"+":"-"}${Math.abs(b)}x_2 = ${c}`}</div>`
points = {const result = [];for (let i =0; i <200; i++) {const x = i /10-10;if (b !==0) {const y = (c - a * x) / b;if (y >=-10&& y <=10) { result.push({x, y}); } } }return result;}// Create the plotPlot.plot({style:"overflow: visible; display: block; margin: 0 auto;",width:500,height:400,grid:true,x: {label:"x_1",domain: [-10,10]},y: {label:"x_2",domain: [-10,10]},marks: [ Plot.ruleY([0]), Plot.ruleX([0]), Plot.line(points, {x:"x",y:"y",stroke:"steelblue",strokeWidth:2 }) ]})